use of com.devonfw.cobigen.impl.config.entity.Template in project cobigen by devonfw.
the class TemplatesConfigurationReaderTest method testCorrectResolutionOfTemplateScanReferences.
/**
* Tests the correct resolution of template scan references in increments.
*
* @throws InvalidConfigurationException test fails
*/
@Test
public void testCorrectResolutionOfTemplateScanReferences() throws InvalidConfigurationException {
// given
TemplatesConfigurationReader reader = new TemplatesConfigurationReader(new File(testFileRootPath).toPath(), "valid_template_scan_references");
Trigger trigger = new Trigger("", "asdf", "", Charset.forName("UTF-8"), new LinkedList<Matcher>(), new LinkedList<ContainerMatcher>());
// when
Map<String, Template> templates = reader.loadTemplates(trigger);
Map<String, Increment> increments = reader.loadIncrements(templates, trigger);
// validation
assertThat(templates).containsOnlyKeys("prefix_foo_BarClass.java", "prefix_bar_Foo2Class.java", "prefix_foo_FooClass.java");
assertThat(increments).containsOnlyKeys("test");
assertThat(increments.get("test").getTemplates()).extracting("name").containsOnly("prefix_foo_BarClass.java", "prefix_foo_FooClass.java");
}
Aggregations