use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method illegalValue.
@Test(expected = SourceChecker.CheckerError.class)
public void illegalValue() {
AnnotationBuilder builder = new AnnotationBuilder(env, AnnoWithStringArg.class);
builder.setValue("value", 1);
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method testEnumPositive.
@Test
public void testEnumPositive() {
AnnotationBuilder builder = new AnnotationBuilder(env, EnumElt.class);
builder.setValue("value", MyEnum.OK);
builder.setValue("value", MyEnum.NOT);
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method listArrayObject.
@Test
public void listArrayObject() {
AnnotationBuilder builder = new AnnotationBuilder(env, B.class);
builder.setValue("strings", new String[] { "m", "n" });
assertEquals(1, builder.build().getElementValues().size());
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method primitiveValueWithException.
@Test(expected = SourceChecker.CheckerError.class)
public void primitiveValueWithException() {
AnnotationBuilder builder = new AnnotationBuilder(env, A.class);
builder.setValue("a", 3.0);
assertEquals(1, builder.build().getElementValues().size());
}
use of org.checkerframework.javacutil.AnnotationBuilder in project checker-framework by typetools.
the class AnnotationBuilderTest method createAnnoWithoutValues1.
@Test
public void createAnnoWithoutValues1() {
AnnotationBuilder builder = new AnnotationBuilder(env, AnnoWithStringArg.class);
AnnotationMirror anno = builder.build();
assertEquals(0, anno.getElementValues().size());
}
Aggregations