One more test fix

This commit is contained in:
James Agnew 2019-03-12 13:24:18 -04:00
parent 5011857219
commit e3ecf21fa9
3 changed files with 19 additions and 3 deletions

View File

@ -58,7 +58,7 @@ public abstract class BaseThymeleafNarrativeGenerator extends ThymeleafNarrative
List<String> propFileName = getPropertyFile();
try {
NarrativeTemplateManifest manifest = NarrativeTemplateManifest.forManifestFileContents(propFileName);
NarrativeTemplateManifest manifest = NarrativeTemplateManifest.forManifestFileLocation(propFileName);
setManifest(manifest);
} catch (IOException e) {
throw new InternalErrorException(e);

View File

@ -92,6 +92,22 @@ public class NarrativeTemplateManifest implements INarrativeTemplateManifest {
}
}
public static NarrativeTemplateManifest forManifestFileLocation(String... thePropertyFilePaths) throws IOException {
return forManifestFileLocation(Arrays.asList(thePropertyFilePaths));
}
public static NarrativeTemplateManifest forManifestFileLocation(Collection<String> thePropertyFilePaths) throws IOException {
ourLog.debug("Loading narrative properties file(s): {}", thePropertyFilePaths);
List<String> manifestFileContents = new ArrayList<>(thePropertyFilePaths.size());
for (String next : thePropertyFilePaths) {
String resource = loadResource(next);
manifestFileContents.add(resource);
}
return forManifestFileContents(manifestFileContents);
}
public static NarrativeTemplateManifest forManifestFileContents(String... theResources) throws IOException {
return forManifestFileContents(Arrays.asList(theResources));
}

View File

@ -58,7 +58,7 @@ public class ThymeleafNarrativeGeneratorTest {
ref.setReference("DiagnosticReport/1").setResource(dr1);
sect.getEntry().add(ref);
NarrativeTemplateManifest manifest = NarrativeTemplateManifest.forManifestFileContents("classpath:narrative2/narratives.properties");
NarrativeTemplateManifest manifest = NarrativeTemplateManifest.forManifestFileLocation("classpath:narrative2/narratives.properties");
ThymeleafNarrativeGenerator gen = new ThymeleafNarrativeGenerator();
gen.setManifest(manifest);
@ -78,7 +78,7 @@ public class ThymeleafNarrativeGeneratorTest {
@Test
public void testTemplateCount() throws IOException {
NarrativeTemplateManifest manifest = NarrativeTemplateManifest.forManifestFileContents("classpath:narrative2/narratives.properties");
NarrativeTemplateManifest manifest = NarrativeTemplateManifest.forManifestFileLocation("classpath:narrative2/narratives.properties");
assertEquals(4, manifest.getNamedTemplateCount());
}