@Test void getCustomizersWhenCustomizersDeclared() { when(this.source.getProperty("groovy.compilationCustomizers", Collections.emptyList())).thenReturn( Arrays.asList("mycustomizer")); when(this.customizer.createCustomizer()).thenReturn(new CompilationCustomizer(CompilePhase.PARSING) { @Override public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException { } }); List<CompilationCustomizer> customizers = this.configuration.getCompilationCustomizers(); assertEquals(1, customizers.size()); assertTrue(customizers.get(0) instanceof CompilationCustomizer); }
@Override public List<CompilationCustomizer> getCompilationCustomizers() { List<CompilationCustomizer> customizers = new ArrayList<>(); for (String customizerName : getCompilationCustomizerNames()) { try { GroovyCompilationCustomizer customizer = this.componentManager.getInstance(GroovyCompilationCustomizer.class, customizerName); CompilationCustomizer compilationCustomizer = customizer.createCustomizer(); if (compilationCustomizer != null) { customizers.add(compilationCustomizer); } } catch (Exception e) { this.logger.warn("Failed to create the Groovy Compilation Customizer named [{}]", customizerName, e); } } return customizers; }
DefaultGroovyConfiguration implements GroovyConfiguration { @Override public List<CompilationCustomizer> getCompilationCustomizers() { List<CompilationCustomizer> customizers = new ArrayList<>(); for (String customizerName : getCompilationCustomizerNames()) { try { GroovyCompilationCustomizer customizer = this.componentManager.getInstance(GroovyCompilationCustomizer.class, customizerName); CompilationCustomizer compilationCustomizer = customizer.createCustomizer(); if (compilationCustomizer != null) { customizers.add(compilationCustomizer); } } catch (Exception e) { this.logger.warn("Failed to create the Groovy Compilation Customizer named [{}]", customizerName, e); } } return customizers; } }
DefaultGroovyConfiguration implements GroovyConfiguration { @Override public List<CompilationCustomizer> getCompilationCustomizers() { List<CompilationCustomizer> customizers = new ArrayList<>(); for (String customizerName : getCompilationCustomizerNames()) { try { GroovyCompilationCustomizer customizer = this.componentManager.getInstance(GroovyCompilationCustomizer.class, customizerName); CompilationCustomizer compilationCustomizer = customizer.createCustomizer(); if (compilationCustomizer != null) { customizers.add(compilationCustomizer); } } catch (Exception e) { this.logger.warn("Failed to create the Groovy Compilation Customizer named [{}]", customizerName, e); } } return customizers; }  }
DefaultGroovyConfiguration implements GroovyConfiguration { @Override public List<CompilationCustomizer> getCompilationCustomizers() { List<CompilationCustomizer> customizers = new ArrayList<>(); for (String customizerName : getCompilationCustomizerNames()) { try { GroovyCompilationCustomizer customizer = this.componentManager.getInstance(GroovyCompilationCustomizer.class, customizerName); CompilationCustomizer compilationCustomizer = customizer.createCustomizer(); if (compilationCustomizer != null) { customizers.add(compilationCustomizer); } } catch (Exception e) { this.logger.warn("Failed to create the Groovy Compilation Customizer named [{}]", customizerName, e); } } return customizers; }  @Override List<String> getCompilationCustomizerNames(); @Override List<CompilationCustomizer> getCompilationCustomizers(); }
DefaultGroovyConfiguration implements GroovyConfiguration { @Override public List<CompilationCustomizer> getCompilationCustomizers() { List<CompilationCustomizer> customizers = new ArrayList<>(); for (String customizerName : getCompilationCustomizerNames()) { try { GroovyCompilationCustomizer customizer = this.componentManager.getInstance(GroovyCompilationCustomizer.class, customizerName); CompilationCustomizer compilationCustomizer = customizer.createCustomizer(); if (compilationCustomizer != null) { customizers.add(compilationCustomizer); } } catch (Exception e) { this.logger.warn("Failed to create the Groovy Compilation Customizer named [{}]", customizerName, e); } } return customizers; }  @Override List<String> getCompilationCustomizerNames(); @Override List<CompilationCustomizer> getCompilationCustomizers();  }