TemplateExecution { public String dynamicAnnotationTakeOver(String... fullTypes) { StringBuilder sb = new StringBuilder(); if (!isAbstract()) { for (String fullType : fullTypes) { sb.append(dynamicAnnotationSupport(fullType, true, true)); } } else { if (fullTypes.length > 1) { sb.append(" } else { sb.append(" } for (String fullType : fullTypes) { sb.append(" } } return sb.toString(); }  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 dynamicAnnotationTakeOver1() { ImportsContext.setIsExtendedByUser(true); ImportsHolder ih = new ImportsHolder(""); ImportsContext.setCurrentImportsHolder(ih); TemplateExecution te = new TemplateExecution(); String result = te.dynamicAnnotationTakeOver("com.test.Toto(\"abc\")"); Assertions.assertThat(result).isEqualTo(" Assertions.assertThat(ih.getList()).isEmpty(); }
@Test public void dynamicAnnotationTakeOver2() { ImportsContext.setIsExtendedByUser(false); ImportsHolder ih = new ImportsHolder(""); ImportsContext.setCurrentImportsHolder(ih); TemplateExecution te = new TemplateExecution(); String result = te.dynamicAnnotationTakeOver("com.test.Toto(\"abc\")"); Assertions.assertThat(result).isEqualTo("@Toto(\"abc\")\n"); Assertions.assertThat(ih.getList().get(0).getPackageName()).isEqualTo("com.test.Toto"); }