From fca24063e04a00420d668f0981133e82ecfd542c Mon Sep 17 00:00:00 2001 From: drivenflywheel Date: Wed, 6 Sep 2023 16:51:22 +0000 Subject: [PATCH] Allow IdentificationTests to override the strategy used for resolving the expected form --- .../test/core/junit5/IdentificationTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/java/emissary/test/core/junit5/IdentificationTest.java b/src/test/java/emissary/test/core/junit5/IdentificationTest.java index 5fbede9ba3..8460410829 100644 --- a/src/test/java/emissary/test/core/junit5/IdentificationTest.java +++ b/src/test/java/emissary/test/core/junit5/IdentificationTest.java @@ -57,7 +57,7 @@ public void testIdentificationPlace(String resource) { try (InputStream doc = new ResourceReader().getResourceAsStream(resource)) { byte[] data = IOUtils.toByteArray(doc); - String expectedAnswer = resource.replaceAll("^.*/([^/@]+)(@\\d+)?\\.dat$", "$1"); + String expectedAnswer = resolveFormForResource(resource); IBaseDataObject payload = DataObjectFactory.getInstance(data, resource, Form.UNKNOWN); processPreHook(payload, resource); place.agentProcessHeavyDuty(payload); @@ -71,6 +71,16 @@ public void testIdentificationPlace(String resource) { } } + /** + * Resolves the expected form for the test resource. + * + * @param resource complete file path of the test resource + * @return form expected for the resource + */ + protected String resolveFormForResource(String resource) { + return resource.replaceAll("^.*/([^/@]+)(@\\d+)?\\.dat$", "$1"); + } + protected void processPreHook(IBaseDataObject payload, String resource) { // Nothing to do here }