11package uk .nhs .adaptors .gp2gp .ehr .mapper ;
22
33import static org .assertj .core .api .AssertionsForClassTypes .assertThat ;
4+ import static org .junit .Assert .assertTrue ;
45import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
56import static org .mockito .ArgumentMatchers .any ;
67import 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