TemplateExecution { protected String dynamicAnnotationSupport(String fullType, boolean invokeRequire, boolean appendEol) { String eol = appendEol ? "\n" : ""; if (fullType.contains("(")) { String fullTypeToImport = substringBefore(fullType, "("); String body = "(" + substringAfter(fullType, "("); if (invokeRequire) { require(fullTypeToImport); } if (fullTypeToImport.contains(".")) { return "@" + substringAfterLast(fullTypeToImport, ".") + body + eol; } else { return "@" + fullTypeToImport + body + eol; } } else { if (invokeRequire) { require(fullType); } if (fullType.contains(".")) { return "@" + substringAfterLast(fullType, ".") + eol; } else { return "@" + fullType + eol; } } }  String java(GeneratedPackage generatedPackage, String javaClassName); String java(EnumNamer enumNamer); String java(ClassNamer classNamer); String java(ClassNamer classNamer, String javaClassName); String java(String javaPackageOrFolder, String javaClassName); String java(ClassNamer2 classNamer2); String java(ClassNamer2 classNamer2, String javaClassName); String javaTest(GeneratedPackage generatedPackage, String javaClassName); String javaTest(ClassNamer classNamer); String javaInTest(ClassNamer classNamer); String javaTest(ClassNamer classNamer, String javaClassName); String javaTest(String javaPackageOrFolder, String javaClassName); void javaTest(ClassNamer2 classNamer2); String config(String subFolder, String fileName); String resource(String resourceName); String resource(String subFolder, String resourceName); String resource(GeneratedPackage generatedPackage, String resourceName); String localization(String resourceName); String localization(String subFolder, String resourceName); String domainLocalization(String resourceName); String domainLocalization(String subFolder, String resourceName); String resourceTest(String resourceName); String resourceTest(String subFolder, String resourceName); String resourceTest(GeneratedPackage generatedPackage, String resourceName); String sql(String sqlFilename); String sql(String subFolder, String sqlFilename); String spring(String springFilename); String spring(String subFolder, String springFilename); String springTest(String springFilename); String webapp(String filename); String webapp(String subFolder, String filename); String flow(String subFolder, String filename); String webinf(String filename); String webinf(String filePath, String filename); String view(String filename); String view(String filePath, String filename); String file(String filename); String file(String filePath, String filename); String site(String filename); String site(String filePath, String filename); String getHeaderComment(); String getHeaderComment(String prepend); void module(String module); String getCurrentClass(); String getCurrentRootClass(); String getCurrentRootCast(); String getCurrentRootCast(String generic1); String getCurrentRootCast(String generic1, String generic2); String getCurrentRootCast(String generic1, String generic2, String generic3); String getCurrentClassWithout_(); boolean isAbstract(); String getAbstractSpace(); String enableDynaImports(); boolean isDynamicImportEnabled(); void require(String fullType); void require(Namer namer); void requireMetamodel(Namer namer); void require(GeneratedPackage generatedPackage, String simpleClassName); void require(Namer packageNamer, Namer classNamer); void require(List<PackageImport> packageImports); void requireStatic(String fullType); void requireStatic(GeneratedPackage generatedPackage, String simpleClassName); boolean requireFirstTime(String fullType); boolean requireFirstTime(Namer namer); void require(Attribute attribute); boolean requireFirstTime(Attribute attribute); String dynamicAnnotation(String fullType); String dynamicAnnotationTakeOver(String... fullTypes); String generateIf(Module module); String generateIf(boolean value); String generateIf(boolean value1, boolean value2); String skipIf(Module module); String skipIf(boolean value); String stopFileGeneration(boolean stop); String stopFileGeneration(); @Override String toString(); void createMetaModelTakeOver(ClassNamer entityModel, String content);  }
@Test public void dynamicAnnotationSupport() { TemplateExecution te = new TemplateExecution(); String result = te.dynamicAnnotationSupport("com.test.Toto(\"abc\")", false, false); Assertions.assertThat(result).isEqualTo("@Toto(\"abc\")"); result = te.dynamicAnnotationSupport("com.test.Toto", false, false); Assertions.assertThat(result).isEqualTo("@Toto"); result = te.dynamicAnnotationSupport("Toto", false, false); Assertions.assertThat(result).isEqualTo("@Toto"); }