Skip to content

Commit

Permalink
[NIAD-3144] Improve test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-nhs committed Aug 19, 2024
1 parent dcce21a commit 8053607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions service/src/test/java/uk/nhs/adaptors/gp2gp/TestUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public final class TestUtility {
private TestUtility() { }
private static final String CONFIDENTIALITY_CODE = "confidentialityCode";
private static final String NOPAT_CONFIDENTIALITY_CODE = """
<confidentialityCode
code="NOPAT"
Expand Down Expand Up @@ -36,8 +37,8 @@ public static void assertThatXmlContainsNopatConfidentialityCode(String xml) {
assertThat(xml).contains(NOPAT_CONFIDENTIALITY_CODE);
}

public static void assertThatXmlDoesNotContainNopatConfidentialityCode(String xml) {
assertThat(xml).doesNotContain(NOPAT_CONFIDENTIALITY_CODE);
public static void assertThatXmlDoesNotContainConfidentialityCode(String xml) {
assertThat(xml).doesNotContain(CONFIDENTIALITY_CODE);
}

public static <R extends DomainResource> String getSecurityCodeFromResource(R resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void When_DiagnosticReport_With_NoscrubMetaSecurity_Expect_ConfidentialityCodeNo
final String result = mapper.mapDiagnosticReportToCompoundStatement(diagnosticReport);

assertAll(
() -> TestUtility.assertThatXmlDoesNotContainNopatConfidentialityCode(result),
() -> TestUtility.assertThatXmlDoesNotContainConfidentialityCode(result),
() -> assertThat(TestUtility.getSecurityCodeFromResource(diagnosticReport)).isEqualTo("NOSCRUB")
);
}
Expand Down

0 comments on commit 8053607

Please sign in to comment.