public class ModelRule extends Model implements org.junit.rules.TestRule
TestRule for creating javax.lang.model instances in a unit
test.
The standard javax.lang.model.util objects, and TypeMirror instances for existing classes, are readily available. More complex elements can be constructed from Java source code snippets,
allowing top-level types and even code with errors in to be contained within a single test
method.
@RunWith(JUnit4.class) public class TypeUtilsTest {@Rulepublic final ModelRule model = new ModelRule();@Testpublic void aTest() { TypeMirror intType =model.typeMirror(int.class); TypeElement myType =model.newType( "package my.test.package;", "public class MyType {", " public void aMethod(int anArg);", "}"); ...
| Constructor and Description |
|---|
ModelRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
create, destroy, elementUtils, environment, newElementAnnotatedWith, newElementWithMarker, newType, start, typeElement, typeElement, typeMirror, typeMirror, typeMirror, typeUtilsCopyright © 2015 inferred.org. All rights reserved.