use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationDeclarationTransformationsTest method replacingMember.
@Test
public void replacingMember() throws IOException {
considerExample("AnnotationDeclaration_Example3_original");
cu.getAnnotationDeclarationByName("ClassPreamble").get().setMember(2, new AnnotationMemberDeclaration(EnumSet.noneOf(Modifier.class), PrimitiveType.intType(), "foo", null));
assertTransformed("AnnotationDeclaration_Example7", cu);
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method replacingJavadoc.
@Test
public void replacingJavadoc() {
AnnotationMemberDeclaration it = consider("/** Cool this annotation!*/ int foo();");
it.setJavadocComment("Super extra cool this annotation!!!");
assertTransformedToString("@interface AD { /** Super extra cool this annotation!!!*/ int foo(); }", it.getParentNode().get());
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method addingJavadoc.
// Javadoc
@Test
public void addingJavadoc() {
AnnotationMemberDeclaration it = consider("int foo();");
it.setJavadocComment("Cool this annotation!");
assertTransformedToString("@interface AD { /** Cool this annotation!*/" + EOL + "int foo(); }", it.getParentNode().get());
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method addingAnnotation.
// Annotations
@Test
public void addingAnnotation() {
AnnotationMemberDeclaration it = consider("int foo();");
it.addAnnotation("myAnno");
assertTransformedToString("@myAnno()" + EOL + "int foo();", it);
}
use of com.github.javaparser.ast.body.AnnotationMemberDeclaration in project javaparser by javaparser.
the class AnnotationMemberDeclarationTransformationsTest method replacingDefaultValue.
@Test
public void replacingDefaultValue() {
AnnotationMemberDeclaration md = consider("int foo() default 10;");
md.setDefaultValue(new IntegerLiteralExpr("11"));
assertTransformedToString("int foo() default 11;", md);
}
Aggregations