public abstract class AsmTest extends Object
allClassesAndAllApis()
method, selected test methods can be instantiated for each possible (precompiled class, ASM
API) tuple.
public class MyParameterizedTest extends AsmTest { @ParameterizedTest @MethodSource(ALL_CLASSES_AND_ALL_APIS) public void testSomeFeature(PrecompiledClass classParameter, Api apiParameter) { byte[] b = classParameter.getBytes(); ClassWriter classWriter = new ClassWriter(apiParameter.value(), 0); ... } }
Modifier and Type | Class and Description |
---|---|
static class |
AsmTest.Api
An ASM API version.
|
static class |
AsmTest.ClassSubject
Helper to make assertions about a class.
|
static class |
AsmTest.InvalidClass
An invalid class, hand-crafted to contain some set of invalid class file structures.
|
static class |
AsmTest.PrecompiledClass
A precompiled class, hand-crafted to contain some set of class file structures.
|
Modifier and Type | Field and Description |
---|---|
static String |
ALL_CLASSES_AND_ALL_APIS
MethodSource name to be used in parameterized tests that must be instantiated for all possible
(precompiled class, api) pairs.
|
static String |
ALL_CLASSES_AND_LATEST_API
MethodSource name to be used in parameterized tests that must be instantiated for all
precompiled classes, with the latest api.
|
Constructor and Description |
---|
AsmTest() |
Modifier and Type | Method and Description |
---|---|
static Stream<org.junit.jupiter.params.provider.Arguments> |
allClassesAndAllApis()
Builds a list of test arguments for a parameterized test.
|
static Stream<org.junit.jupiter.params.provider.Arguments> |
allClassesAndLatestApi()
Builds a list of test arguments for a parameterized test.
|
static AsmTest.ClassSubject |
assertThatClass(byte[] classFile)
Starts an assertion about the given class content.
|
static boolean |
loadAndInstantiate(String className,
byte[] classContent)
Loads the given class in a new class loader.
|
public static final String ALL_CLASSES_AND_ALL_APIS
public static final String ALL_CLASSES_AND_LATEST_API
public static Stream<org.junit.jupiter.params.provider.Arguments> allClassesAndAllApis()
public static Stream<org.junit.jupiter.params.provider.Arguments> allClassesAndLatestApi()
public static AsmTest.ClassSubject assertThatClass(byte[] classFile)
classFile
- the content of a class.AsmTest.ClassSubject
to use to make actual assertions about the given class.public static boolean loadAndInstantiate(String className, byte[] classContent)
className
- the name of the class to load.classContent
- the content of the class to load.Copyright © 2018. All rights reserved.