use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testToString3.
@Test
public void testToString3() {
AnnotationBuilder builder = new AnnotationBuilder(env, Anno.class);
builder.setValue("can", new Object[] { 1 });
assertEquals("@tests.AnnotationBuilderTest.Anno(can={1})", builder.build().toString());
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testClassPositive.
@Test
public void testClassPositive() {
AnnotationBuilder builder = new AnnotationBuilder(env, ClassElt.class);
builder.setValue("value", String.class);
builder.setValue("value", int.class);
builder.setValue("value", int[].class);
builder.setValue("value", void.class);
Object storedValue = builder.build().getElementValues().values().iterator().next().getValue();
assertTrue("storedValue is " + storedValue.getClass(), storedValue instanceof TypeMirror);
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testToString1.
@Test
public void testToString1() {
AnnotationBuilder builder = new AnnotationBuilder(env, Anno.class);
assertEquals("@tests.AnnotationBuilderTest.Anno", builder.build().toString());
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testAnnoAsArgPositive.
@Test
public void testAnnoAsArgPositive() {
AnnotationMirror anno = AnnotationBuilder.fromClass(env.getElementUtils(), MyAnno.class);
AnnotationBuilder builder = new AnnotationBuilder(env, ContainingAnno.class);
builder.setValue("value", anno);
assertEquals("@tests.AnnotationBuilderTest.ContainingAnno(@tests.AnnotationBuilderTest.MyAnno)", builder.build().toString());
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testEnumNegative.
@Test(expected = SourceChecker.CheckerError.class)
public void testEnumNegative() {
AnnotationBuilder builder = new AnnotationBuilder(env, EnumElt.class);
builder.setValue("value", 2);
}
Aggregations