diff --git a/src/integrationTest/java/uk/gov/hmcts/darts/cases/controller/CaseControllerAdminGetCaseByIdIntTest.java b/src/integrationTest/java/uk/gov/hmcts/darts/cases/controller/CaseControllerAdminGetCaseByIdIntTest.java index 200b726b8cd..68b663c33c6 100644 --- a/src/integrationTest/java/uk/gov/hmcts/darts/cases/controller/CaseControllerAdminGetCaseByIdIntTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/darts/cases/controller/CaseControllerAdminGetCaseByIdIntTest.java @@ -134,8 +134,8 @@ void adminGetCaseById_WithCaseOpenAndReportingRestrictions() throws Exception { String actualResponse = mvcResult.getResponse().getContentAsString(); String expectedResponse = getContentsFromFile( "tests/cases/CaseControllerAdminGetCaseByIdTest/testCaseOpen/expectedResponse.json"); - expectedResponse = expectedResponse.replace("", courtCase.getCreatedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)); - expectedResponse = expectedResponse.replace("", courtCase.getLastModifiedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)); + expectedResponse = expectedResponse.replace("", formatAsUtc(courtCase.getCreatedDateTime())); + expectedResponse = expectedResponse.replace("", formatAsUtc(courtCase.getLastModifiedDateTime())); JSONAssert.assertEquals(expectedResponse, actualResponse, JSONCompareMode.NON_EXTENSIBLE); } @@ -176,8 +176,8 @@ void adminGetCaseById_WithCaseClosedAndReportingRestrictions() throws Exception String actualResponse = mvcResult.getResponse().getContentAsString(); String expectedResponse = getContentsFromFile( "tests/cases/CaseControllerAdminGetCaseByIdTest/testCaseClosed/expectedResponse.json"); - expectedResponse = expectedResponse.replace("", courtCase.getCreatedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)); - expectedResponse = expectedResponse.replace("", courtCase.getLastModifiedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)); + expectedResponse = expectedResponse.replace("", formatAsUtc(courtCase.getCreatedDateTime())); + expectedResponse = expectedResponse.replace("", formatAsUtc(courtCase.getLastModifiedDateTime())); JSONAssert.assertEquals(expectedResponse, actualResponse, JSONCompareMode.NON_EXTENSIBLE); } @@ -213,8 +213,8 @@ void adminGetCaseById_IsAnonymised() throws Exception { String expectedResponse = getContentsFromFile( "tests/cases/CaseControllerAdminGetCaseByIdTest/testIsAnonymised/expectedResponse.json"); expectedResponse = expectedResponse - .replace("", courtCase.getCreatedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)) - .replace("", courtCase.getLastModifiedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)) + .replace("", formatAsUtc(courtCase.getCreatedDateTime())) + .replace("", formatAsUtc(courtCase.getLastModifiedDateTime())) .replace("", String.valueOf(anonymisedBy.getId())); JSONAssert.assertEquals(expectedResponse, actualResponse, JSONCompareMode.NON_EXTENSIBLE); } @@ -248,8 +248,8 @@ void adminGetCaseById_IsDeleted() throws Exception { String expectedResponse = getContentsFromFile( "tests/cases/CaseControllerAdminGetCaseByIdTest/expectedResponse_isDeleted.json"); expectedResponse = expectedResponse - .replace("", courtCase.getCreatedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)) - .replace("", courtCase.getLastModifiedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)) + .replace("", formatAsUtc(courtCase.getCreatedDateTime())) + .replace("", formatAsUtc(courtCase.getLastModifiedDateTime())) .replace("", String.valueOf(deletedBy.getId())); JSONAssert.assertEquals(expectedResponse, actualResponse, JSONCompareMode.NON_EXTENSIBLE); } @@ -299,8 +299,8 @@ void adminGetCaseById_WithRetentionAndAdditionalCaseDetails() throws Exception { String expectedResponse = getContentsFromFile( "tests/cases/CaseControllerAdminGetCaseByIdTest/expectedResponse_withRetentionAndAdditionalCaseDetails.json"); expectedResponse = expectedResponse - .replace("", courtCase.getCreatedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)) - .replace("", courtCase.getLastModifiedDateTime().format(DateTimeFormatter.ISO_DATE_TIME)); + .replace("", formatAsUtc(courtCase.getCreatedDateTime())) + .replace("", formatAsUtc(courtCase.getLastModifiedDateTime())); JSONAssert.assertEquals(expectedResponse, actualResponse, JSONCompareMode.NON_EXTENSIBLE); } @@ -328,4 +328,8 @@ private List createEventsWithDifferentTimestamps(List message.getMessage().contains(expectedSubstring)), + () -> "Expected validation message containing '%s' but got %s".formatted(expectedSubstring, report.getMessages()) + ); + } }