Skip to content

Commit aeeaae5

Browse files
Tweaked test
1 parent 0f40781 commit aeeaae5

File tree

3 files changed

+462
-2
lines changed

3 files changed

+462
-2
lines changed

service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/mapper/EhrExtractMapperTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package uk.nhs.adaptors.gp2gp.ehr.mapper;
22

33
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
4+
import static org.junit.Assert.assertTrue;
45
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
56
import static org.mockito.ArgumentMatchers.any;
67
import static org.mockito.ArgumentMatchers.eq;
@@ -179,10 +180,10 @@ void When_ValidateXmlAgainstSchemaWithInvalidXmlAndAnyId_Expect_XmlSchemaValidat
179180
}
180181

181182
@Test
182-
void When_ValidateXmlAgainstSchemaWithValidXmlAndAnyId_Expect_NoExceptionIsThrown() throws Exception {
183+
void When_ValidateXmlAgainstSchemaWithValidXmlAndRedactionId_Expect_NoExceptionIsThrown() throws Exception {
183184
String basePath = Paths.get("src/").toFile().getAbsoluteFile().getAbsolutePath()
184185
+ "/../../service/src/test/resources/";
185-
String xmlFilePath = basePath + "complete-and-validated-xml-test-file.xml";
186+
String xmlFilePath = basePath + "complete-and-validated-xml-test-file-redaction.xml";
186187

187188
String validXml = Files.readString(Paths.get(xmlFilePath));
188189

@@ -192,5 +193,19 @@ void When_ValidateXmlAgainstSchemaWithValidXmlAndAnyId_Expect_NoExceptionIsThrow
192193

193194
assertDoesNotThrow(() -> ehrExtractMapper.validateXmlAgainstSchema(validXml));
194195
}
196+
@Test
197+
void When_ValidateXmlAgainstSchemaWithValidXmlAndNonRedactionId_Expect_NoExceptionIsThrown() throws Exception {
198+
String basePath = Paths.get("src/").toFile().getAbsoluteFile().getAbsolutePath()
199+
+ "/../../service/src/test/resources/";
200+
String xmlFilePath = basePath + "complete-and-validated-xml-test-file-non-redaction.xml";
201+
202+
String validXml = Files.readString(Paths.get(xmlFilePath));
195203

204+
Assertions.assertTrue(validXml.contains("RCMR_IN030000UK06"));
205+
206+
when(redactionsContext.ehrExtractInteractionId())
207+
.thenReturn("interaction_id_test");
208+
209+
assertDoesNotThrow(() -> ehrExtractMapper.validateXmlAgainstSchema(validXml));
210+
}
196211
}

0 commit comments

Comments
 (0)