use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method removingDefaultValue.
@Test
public void removingDefaultValue() {
AnnotationMemberDeclaration md = consider("int foo() default 10;");
assertEquals(true, md.getDefaultValue().get().remove());
assertTransformedToString("int foo();", md);
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method removingModifiers.
@Test
public void removingModifiers() {
AnnotationMemberDeclaration md = consider("public int foo();");
md.setModifiers(EnumSet.noneOf(Modifier.class));
assertTransformedToString("int foo();", md);
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method addingDefaultValue.
// Default value
@Test
public void addingDefaultValue() {
AnnotationMemberDeclaration md = consider("int foo();");
md.setDefaultValue(new IntegerLiteralExpr("10"));
assertTransformedToString("int foo() default 10;", md);
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method removingJavadoc.
@Test
public void removingJavadoc() {
AnnotationMemberDeclaration it = consider("/** Cool this annotation!*/ int foo();");
assertTrue(it.getJavadocComment().get().remove());
assertTransformedToString("@interface AD { int foo(); }", it.getParentNode().get());
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationDeclarationTransformationsTest method addingMember.
// members
@Test
public void addingMember() throws IOException {
considerExample("AnnotationDeclaration_Example3_original");
cu.getAnnotationDeclarationByName("ClassPreamble").get().addMember(new AnnotationMemberDeclaration(EnumSet.noneOf(Modifier.class), PrimitiveType.intType(), "foo", null));
assertTransformed("AnnotationDeclaration_Example5", cu);
}
Aggregations