public void testParam() throws Exception {
CompilerAssert<File, File> helper = incrementalCompiler("metamodel.param");
helper.assertCompile();
// Remove @Param
JavaFile file = helper.assertJavaSource("metamodel.param.A");
ClassOrInterfaceDeclaration bean = file.assertDeclaration();
MethodDeclaration index = null;
for (BodyDeclaration decl : bean.getMembers()) {
if (decl instanceof MethodDeclaration) {
index = (MethodDeclaration)decl;
}
}
Parameter param = index.getParameters().get(0);
AnnotationExpr annotation = param.getAnnotations().get(0);
param.getAnnotations().clear();
file.assertSave();
// helper.assertRemove("metamodel", "param", "A.java");
// Recompile
// we should have a way to test the error kind more precisely
/*List<CompilationError> errors = */helper.assertCompile();
// assertEquals(1, errors.size());
// Add back @Param
param.getAnnotations().add(annotation);
file.assertSave();
// Recompile
helper.assertCompile();
// Check