Extension { public Optional<Class<? extends TransformationTemplate>> automaticResolution(File applicationFolder) throws TemplateResolutionException { return Optional.empty(); }  abstract String getDescription(); abstract String getVersion(); final List<Class<? extends TransformationTemplate>> getTemplateClasses(); Optional<Class<? extends TransformationTemplate>> automaticResolution(File applicationFolder); @Override final String toString();  }
@Test public void automaticResolutionTest() throws URISyntaxException, TemplateResolutionException { File appFolder = new File(getClass().getResource("/test-app").toURI()); Extension extension = new Extension() { @Override public String getDescription() {return null;} @Override public String getVersion() {return null;} @Override public Optional<Class<? extends TransformationTemplate>> automaticResolution(File applicationFolder) { return Optional.of((Class<? extends TransformationTemplate>) getTemplateClasses().get(0)); } }; extension.add(SampleTransformationTemplate2.class); assertEquals(extension.automaticResolution(appFolder).get(), SampleTransformationTemplate2.class); }
@Test public void notSupportedAutomaticResolutionTest() throws URISyntaxException, TemplateResolutionException { File appFolder = new File(getClass().getResource("/test-app").toURI()); assertFalse(new SampleExtension().automaticResolution(appFolder).isPresent()); }