From 7fd01e950b5882b33e4e8c638b7bd87abe6e2fa1 Mon Sep 17 00:00:00 2001 From: Ole <12736698+ole4ryb@users.noreply.github.com> Date: Mon, 11 Nov 2024 14:22:25 +0000 Subject: [PATCH] Code cleanup: removing unused code variables, excessing throwables and making test assessments more concise (#920) * removing unused code variables, excessing throwables and making test assessments more concise * revert to original equals * removal of unused code --- .../translator/mapper/ImmunizationMapper.java | 22 ------------ .../mapper/ReferralRequestMapperTest.java | 2 -- .../translator/mapper/TemplateMapperTest.java | 36 ++----------------- .../DiagnosticReportMapperTest.java | 6 ---- .../SpecimenCompoundsMapperTest.java | 7 ---- .../medication/MedicationMapperUtilsTest.java | 1 - .../FailedProcessHandlingServiceTest.java | 11 +++--- .../InboundMessageMergingServiceTests.java | 8 ++--- .../SkeletonProcessingServiceTests.java | 15 +++----- .../task/COPCMessageHandlerTest.java | 3 +- .../task/EhrExtractMessageHandlerTest.java | 2 +- .../util/CompoundStatementUtilTest.java | 6 ++-- .../translator/util/ObservationUtilTest.java | 1 - .../PatientTransferControllerTest.java | 1 - 14 files changed, 22 insertions(+), 99 deletions(-) diff --git a/gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/mapper/ImmunizationMapper.java b/gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/mapper/ImmunizationMapper.java index 6cc034aea..d70774ab4 100644 --- a/gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/mapper/ImmunizationMapper.java +++ b/gp2gp-translator/src/main/java/uk/nhs/adaptors/pss/translator/mapper/ImmunizationMapper.java @@ -124,28 +124,6 @@ private static void setPractiotionerAndAsserter(RCMRMT030101UKEhrComposition ehr .addPractitioner(asserter); } - private void setPractitioners(Immunization immunization, RCMRMT030101UKObservationStatement observationStatement, - RCMRMT030101UKEhrComposition ehrComposition) { - - var recorderAndAsserter = ParticipantReferenceUtil.fetchRecorderAndAsserter(ehrComposition); - - var practitioner = Optional.ofNullable(getParticipantReference( - observationStatement.getParticipant(), - ehrComposition)); - - practitioner.ifPresent(participant -> { - var asserter = getImmunizationPractitioner(participant, ""); - immunization.addPractitioner(asserter); - - recorderAndAsserter.get(RECORDER).ifPresent(recorderRef -> { - if (!recorderRef.getReference().equals(participant.getReference())) { - var recorder = getImmunizationPractitioner(recorderRef, "EP"); - immunization.addPractitioner(recorder); - } - }); - }); - } - private Immunization initializeImmunization(RCMRMT030101UKObservationStatement observationStatement, RCMRMT030101UKEhrComposition ehrComposition, List encounterList, diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/ReferralRequestMapperTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/ReferralRequestMapperTest.java index 6a0a1edd6..32114fe93 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/ReferralRequestMapperTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/ReferralRequestMapperTest.java @@ -70,8 +70,6 @@ class ReferralRequestMapperTest { private static final String PRIORITY_NOTE_PREPENDAGE = "Priority: "; private static final String NOPAT = "NOPAT"; - private static final String NOSCRUB = "NOSCRUB"; - private static final String TEST_DIRECTORY_NAME = "RequestStatement"; @Mock diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/TemplateMapperTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/TemplateMapperTest.java index 0ba0ff245..c95aa0cad 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/TemplateMapperTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/TemplateMapperTest.java @@ -16,7 +16,6 @@ import org.hl7.fhir.dstu3.model.Encounter; import org.hl7.fhir.dstu3.model.Observation; import org.hl7.fhir.dstu3.model.Patient; -import org.hl7.fhir.dstu3.model.QuestionnaireResponse; import org.hl7.v3.RCMRMT030101UKEhrExtract; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -44,7 +43,6 @@ public class TemplateMapperTest { + "-QuestionnaireResponse-1"; private static final String OBSERVATION_META = "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Observation-1"; private static final String IDENTIFIER = "https://PSSAdaptor/TESTPRACTISECODE"; - private static final int THREE = 3; private static final String SNOMED_SYSTEM = "http://snomed.info/sct"; private static final CodeableConcept CODEABLE_CONCEPT = createCodeableConcept(null, SNOMED_SYSTEM, CODING_DISPLAY_MOCK); @@ -71,13 +69,10 @@ public void testMapTemplateWithAllData() { var mappedResources = templateMapper.mapResources(ehrExtract, getPatient(), ENCOUNTER_LIST, PRACTISE_CODE); assertThat(mappedResources.size()).isEqualTo(1); - // var questionnaireResponse = (QuestionnaireResponse) mappedResources.getFirst(); + var parentObservation = (Observation) mappedResources.getFirst(); - // assertQuestionnaireResponse(questionnaireResponse, ENCOUNTER_ID, "original-text", "20100113151332"); assertParentObservation(parentObservation, ENCOUNTER_ID, "20100113151332", "3707E1F0-9011-11EC-B1E5-0800200C9A66"); - - // verify(resourceReferenceUtil, atLeast(1)).extractChildReferencesFromTemplate(any(), anyList()); } @Test @@ -90,14 +85,11 @@ public void testMapTemplateWithFallbackData() { var mappedResources = templateMapper.mapResources(ehrExtract, getPatient(), ENCOUNTER_LIST, PRACTISE_CODE); assertThat(mappedResources.size()).isEqualTo(1); -// var questionnaireResponse = (QuestionnaireResponse) mappedResources.getFirst(); + var parentObservation = (Observation) mappedResources.getFirst(); -// assertQuestionnaireResponse(questionnaireResponse, null, "display-text", "20200101010101"); assertParentObservation(parentObservation, null, null, "9007E1F0-9011-11EC-B1E5-0800200C9A66"); - // The assertion below is poor as we manually select 1 item above / removed -// assertThat(questionnaireResponse.getItem().size()).isOne(); } @Test @@ -110,13 +102,11 @@ public void testMapNestedTemplate() { var mappedResources = templateMapper.mapResources(ehrExtract, getPatient(), ENCOUNTER_LIST, PRACTISE_CODE); assertThat(mappedResources.size()).isEqualTo(1); - //var questionnaireResponse = (QuestionnaireResponse) mappedResources.getFirst(); + var parentObservation = (Observation) mappedResources.getFirst(); - //assertQuestionnaireResponse(questionnaireResponse, null, "display-text", "20200101010101"); assertParentObservation(parentObservation, null, null, "9007E1F0-9011-11EC-B1E5-0800200C9A66"); - // verify(resourceReferenceUtil, atLeast(1)).extractChildReferencesFromTemplate(any(), anyList()); } @Test @@ -184,26 +174,6 @@ public void When_MapTemplateWithoutSnomedCode_Expect_DegradedCode() { assertThat(parentObservation.getCode().getCodingFirstRep()).isEqualTo(DegradedCodeableConcepts.DEGRADED_OTHER); } - private void assertQuestionnaireResponse(QuestionnaireResponse questionnaireResponse, String encounter, String linkId, - String authored) { - assertThat(questionnaireResponse.getId()).isEqualTo(COMPOUND_ID + QUESTIONNAIRE_SUFFIX); - assertThat(questionnaireResponse.getMeta().getProfile().getFirst().getValue()).isEqualTo(QUESTIONNAIRE_META); - assertThat(questionnaireResponse.getIdentifier().getSystem()).isEqualTo(IDENTIFIER); - assertThat(questionnaireResponse.getIdentifier().getValue()).isEqualTo(COMPOUND_ID); - assertThat(questionnaireResponse.getParentFirstRep().getResource().getIdElement().getValue()).isEqualTo(COMPOUND_ID); - assertThat(questionnaireResponse.getStatus()).isEqualTo(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); - assertThat(questionnaireResponse.getSubject().getResource().getIdElement().getValue()).isEqualTo(PATIENT_ID); - assertThat(questionnaireResponse.getItemFirstRep().getLinkId()).isEqualTo(linkId); - assertThat(questionnaireResponse.getAuthoredElement().asStringValue()).isEqualTo( - DateFormatUtil.parseToDateTimeType(authored).asStringValue()); - - if (encounter == null) { - assertThat(questionnaireResponse.getContext().getResource()).isNull(); - } else { - assertThat(questionnaireResponse.getContext().getResource().getIdElement().getValue()).isEqualTo(encounter); - } - } - private void assertParentObservation(Observation parentObservation, String encounter, String issued, String performer) { assertThat(parentObservation.getId()).isEqualTo(COMPOUND_ID); assertThat(parentObservation.getMeta().getProfile().getFirst().getValue()).isEqualTo(OBSERVATION_META); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/DiagnosticReportMapperTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/DiagnosticReportMapperTest.java index 485397acb..8ee0cfc1f 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/DiagnosticReportMapperTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/DiagnosticReportMapperTest.java @@ -28,7 +28,6 @@ import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.dstu3.model.Observation; import org.hl7.fhir.dstu3.model.Patient; -import org.hl7.v3.CV; import org.hl7.v3.RCMRMT030101UKCompoundStatement; import org.hl7.v3.RCMRMT030101UKEhrComposition; import org.hl7.v3.RCMRMT030101UKEhrExtract; @@ -42,7 +41,6 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import uk.nhs.adaptors.pss.translator.util.MetaUtil; -import uk.nhs.adaptors.pss.translator.TestUtility; import uk.nhs.adaptors.pss.translator.service.ConfidentialityService; import uk.nhs.adaptors.pss.translator.service.IdGeneratorService; import uk.nhs.adaptors.pss.translator.util.DateFormatUtil; @@ -65,10 +63,6 @@ public class DiagnosticReportMapperTest { private static final String CONCLUSION_FIELD_TEXT = "TEXT_OF_DIRECT_COMPOUND_STATEMENT_CHILD_NARRATIVE_STATEMENT_1\n" + "TEXT_OF_DIRECT_COMPOUND_STATEMENT_CHILD_NARRATIVE_STATEMENT_2"; private static final Meta META = MetaUtil.getMetaFor(META_WITH_SECURITY, DIAGNOSTIC_REPORT_META_SUFFIX); - private static final CV NOPAT_CV = TestUtility.createCv( - "NOPAT", - "http://hl7.org/fhir/v3/ActCode", - "no disclosure to patient, family or caregivers without attending provider's authorization"); private static final String NARRATIVE_STATEMENT_COMMENT_BLOCK = """ CommentType:LABORATORY RESULT COMMENT(E141) diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/SpecimenCompoundsMapperTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/SpecimenCompoundsMapperTest.java index 9a34bbef1..ab411a9c0 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/SpecimenCompoundsMapperTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/diagnosticreport/SpecimenCompoundsMapperTest.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; - import org.hl7.fhir.dstu3.model.DiagnosticReport; import org.hl7.fhir.dstu3.model.IdType; import org.hl7.fhir.dstu3.model.Meta; @@ -28,7 +27,6 @@ import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Reference; import org.hl7.fhir.dstu3.model.ResourceType; -import org.hl7.v3.CV; import org.hl7.v3.RCMRMT030101UKCompoundStatement; import org.hl7.v3.RCMRMT030101UKEhrComposition; import org.hl7.v3.RCMRMT030101UKEhrExtract; @@ -44,7 +42,6 @@ import lombok.SneakyThrows; import org.mockito.stubbing.Answer1; import uk.nhs.adaptors.pss.translator.util.MetaUtil; -import uk.nhs.adaptors.pss.translator.TestUtility; import uk.nhs.adaptors.pss.translator.service.ConfidentialityService; @ExtendWith(MockitoExtension.class) @@ -64,10 +61,6 @@ public class SpecimenCompoundsMapperTest { private static final String TEST_COMMENT_LINE_1 = "Test Comment"; private static final String META_PROFILE = "Observation-1"; private static final Meta META = MetaUtil.getMetaFor(META_WITH_SECURITY, META_PROFILE); - private static final CV NOPAT_CV = TestUtility.createCv( - "NOPAT", - "http://hl7.org/fhir/v3/ActCode", - "no disclosure to patient, family or caregivers without attending provider's authorization"); private static final Patient PATIENT = (Patient) new Patient().setId("TEST_PATIENT_ID"); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/medication/MedicationMapperUtilsTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/medication/MedicationMapperUtilsTest.java index a4e023090..4464800e0 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/medication/MedicationMapperUtilsTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/mapper/medication/MedicationMapperUtilsTest.java @@ -29,7 +29,6 @@ public class MedicationMapperUtilsTest { private static final String EXPECTED_CODE_DISPLAY = "NHS prescription"; private static final String AUTHORISE_ID = "8866381C-E5B8-4A6E-ADBC-964F9A77D407"; - private static final String MEDICATION_REQUEST_ID = "a9edfd5e-bd52-461f-8b96-9c5b181af5bf"; @Test public void When_CreatingPrescriptionTypeExtension_Expect_AcuteValues() { diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/FailedProcessHandlingServiceTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/FailedProcessHandlingServiceTest.java index 35c725df5..4cc5d56ea 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/FailedProcessHandlingServiceTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/FailedProcessHandlingServiceTest.java @@ -1,7 +1,6 @@ package uk.nhs.adaptors.pss.translator.service; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -92,7 +91,7 @@ public void When_HandleFailedProcess_With_EhrExtract_Expect_UnexpectedCondition( String conversationId = UUID.randomUUID().toString(); when(ehrExtractMessage.getId()).thenReturn(mockId); - when(nackAckPreparationService.prepareNackMessageData(eq(UNEXPECTED_CONDITION), eq(ehrExtractMessage), eq(conversationId))) + when(nackAckPreparationService.prepareNackMessageData(UNEXPECTED_CONDITION, ehrExtractMessage, conversationId)) .thenReturn(messageData); failedProcessHandlingService.handleFailedProcess(ehrExtractMessage, conversationId); @@ -123,7 +122,7 @@ public void When_HandleFailedProcess_With_COPCAndIncumbentNackdProcess_Expect_Un when(migrationStatusLogService.getLatestMigrationStatusLog(conversationId)) .thenReturn(statusLog); - when(nackAckPreparationService.prepareNackMessageData(eq(UNEXPECTED_CONDITION), eq(copcMessage), eq(conversationId))) + when(nackAckPreparationService.prepareNackMessageData(UNEXPECTED_CONDITION, copcMessage, conversationId)) .thenReturn(messageData); failedProcessHandlingService.handleFailedProcess(copcMessage, conversationId); @@ -142,7 +141,7 @@ public void When_HandleFailedProcess_With_COPCAndLargeMessageTimeout_Expect_Larg when(migrationStatusLogService.getLatestMigrationStatusLog(conversationId)) .thenReturn(statusLog); - when(nackAckPreparationService.prepareNackMessageData(eq(LARGE_MESSAGE_TIMEOUT), eq(copcMessage), eq(conversationId))) + when(nackAckPreparationService.prepareNackMessageData(LARGE_MESSAGE_TIMEOUT, copcMessage, conversationId)) .thenReturn(messageData); failedProcessHandlingService.handleFailedProcess(copcMessage, conversationId); @@ -161,7 +160,7 @@ public void When_HandleFailedProcess_With_COPCAndRequestTimeout_Expect_LargeMess when(migrationStatusLogService.getLatestMigrationStatusLog(conversationId)) .thenReturn(statusLog); - when(nackAckPreparationService.prepareNackMessageData(eq(LARGE_MESSAGE_TIMEOUT), eq(copcMessage), eq(conversationId))) + when(nackAckPreparationService.prepareNackMessageData(LARGE_MESSAGE_TIMEOUT, copcMessage, conversationId)) .thenReturn(messageData); failedProcessHandlingService.handleFailedProcess(copcMessage, conversationId); @@ -206,7 +205,7 @@ public void When_HandleFailedProcess_With_OtherStatus_Expect_LargeMessageGeneral when(migrationStatusLogService.getLatestMigrationStatusLog(conversationId)) .thenReturn(statusLog); - when(nackAckPreparationService.prepareNackMessageData(eq(LARGE_MESSAGE_GENERAL_FAILURE), eq(copcMessage), eq(conversationId))) + when(nackAckPreparationService.prepareNackMessageData(LARGE_MESSAGE_GENERAL_FAILURE, copcMessage, conversationId)) .thenReturn(messageData); failedProcessHandlingService.handleFailedProcess(copcMessage, conversationId); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/InboundMessageMergingServiceTests.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/InboundMessageMergingServiceTests.java index 96726a069..10ed29515 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/InboundMessageMergingServiceTests.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/InboundMessageMergingServiceTests.java @@ -186,7 +186,7 @@ public void When_HappyPathNoSkeleton_Expect_NotToGetAttachmentFromService() thro @Test public void When_UpdateInboundMessageWithSkeletonThrowsSAXException_Expect_SendNack() throws JAXBException, - JsonProcessingException, SAXException, TransformerException, AttachmentNotFoundException, InlineAttachmentProcessingException { + JsonProcessingException, SAXException, TransformerException, InlineAttachmentProcessingException { var inboundMessage = new InboundMessage(); var attachments = createPatientAttachmentList(true, true); @@ -301,7 +301,7 @@ public void When_MergeAndBundleMessageThrowsAttachmentNotFoundException_Expect_S @Test public void When_UpdateInboundMessageWithSkeletonThrowsTransformerException_Expect_SendNack() throws JAXBException, JsonProcessingException, - SAXException, TransformerException, AttachmentNotFoundException, InlineAttachmentProcessingException { + SAXException, TransformerException, InlineAttachmentProcessingException { var inboundMessage = new InboundMessage(); @@ -448,8 +448,8 @@ public void When_MergeAndBundleMessageHasNullOrEmptyParams_Expect_ThrowIllegalSt @Test public void When_AttachmentsPresent_Expect_AttachmentReferenceUpdated() - throws AttachmentNotFoundException, JAXBException, InlineAttachmentProcessingException, JsonProcessingException, - TransformerException, SAXException { + throws AttachmentNotFoundException, JAXBException, InlineAttachmentProcessingException, JsonProcessingException { + var inboundMessage = new InboundMessage(); var attachments = createPatientAttachmentList(true, false); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/SkeletonProcessingServiceTests.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/SkeletonProcessingServiceTests.java index ddd1ee071..04218ab76 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/SkeletonProcessingServiceTests.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/service/SkeletonProcessingServiceTests.java @@ -15,7 +15,6 @@ import java.util.Arrays; import java.util.List; -import jakarta.xml.bind.JAXBException; import javax.xml.transform.TransformerException; import org.junit.jupiter.api.Test; @@ -27,8 +26,6 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; - -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.SneakyThrows; @@ -107,7 +104,7 @@ private void prepareSkeletonNonRCMRMocks(InboundMessage inboundMessage) throws S when(node.getParentNode()).thenReturn(node); } - private void prepareSkeletonRCMRMocks(InboundMessage inboundMessage) throws SAXException, TransformerException { + private void prepareSkeletonRCMRMocks(InboundMessage inboundMessage) throws TransformerException { var fileAsBytes = readInboundMessagePayloadFromFile().getBytes(StandardCharsets.UTF_8); when(xmlParseUtilService.getStringFromDocument(any())).thenReturn(inboundMessage.getPayload()); @@ -115,8 +112,7 @@ private void prepareSkeletonRCMRMocks(InboundMessage inboundMessage) throws SAXE } @Test - public void When_UpdateInboundMessageAttachmentHandlerServiceThrowsIllegalArgumentException_Expect_ThrowsException() - throws JAXBException, JsonProcessingException, TransformerException, SAXException { + public void When_UpdateInboundMessageAttachmentHandlerServiceThrowsIllegalArgumentException_Expect_ThrowsException() { var inboundMessage = new InboundMessage(); var attachmentLog = createSkeletonPatientAttachmentLog(); @@ -147,7 +143,7 @@ public void When_HappyPathWithSkeletonAsRCMRMessage_Expect_ThrowNoErrors() throw @Test public void When_HappyPathWithSkeletonAsRCMRMessage_Expect_InboundMessagePayloadIsNewRCMRMessage() - throws JAXBException, JsonProcessingException, TransformerException, SAXException { + throws TransformerException, SAXException { var inboundMessage = new InboundMessage(); var attachmentLog = createSkeletonPatientAttachmentLog(); @@ -164,7 +160,7 @@ public void When_HappyPathWithSkeletonAsRCMRMessage_Expect_InboundMessagePayload @Test public void When_HappyPathWithSkeletonAsSectionMessage_Expect_ThrowNoErrors() - throws JAXBException, JsonProcessingException, TransformerException, SAXException { + throws TransformerException, SAXException { var inboundMessage = new InboundMessage(); var attachmentLog = createSkeletonPatientAttachmentLog(); @@ -177,8 +173,7 @@ public void When_HappyPathWithSkeletonAsSectionMessage_Expect_ThrowNoErrors() } @Test - public void When_SkeletonAsSectionMessage_Expect_ThrowNoErrors() throws JAXBException, JsonProcessingException, TransformerException, - SAXException { + public void When_SkeletonAsSectionMessage_Expect_ThrowNoErrors() throws TransformerException, SAXException { var inboundMessage = new InboundMessage(); var attachmentLog = createSkeletonPatientAttachmentLog(); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/COPCMessageHandlerTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/COPCMessageHandlerTest.java index c7967a6a9..d55d15f3e 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/COPCMessageHandlerTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/COPCMessageHandlerTest.java @@ -1011,8 +1011,7 @@ public void When_HandleMessage_WithWebClientRequestException_Expect_ExceptionThr @Test public void When_HandleMessage_WithMhsServerErrorException_Expect_ExceptionIsBubbledUpSoMessageIsRetriedByJMS() - throws SAXException, AttachmentNotFoundException, JAXBException, BundleMappingException, JsonProcessingException, - InlineAttachmentProcessingException, AttachmentLogException { + throws SAXException, InlineAttachmentProcessingException { MockedStatic mockedXmlUnmarshall = Mockito.mockStatic(XmlUnmarshallUtil.class); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/EhrExtractMessageHandlerTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/EhrExtractMessageHandlerTest.java index 1c3d04e31..30dc03ce0 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/EhrExtractMessageHandlerTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/task/EhrExtractMessageHandlerTest.java @@ -547,7 +547,7 @@ public void When_HandleSingleMessageWithAFilenameDescription_Expect_PatientAttac public void When_HandleLargeMessageWithValidDataIsCalled_Expect_ItShouldNotTranslate() throws JAXBException, BundleMappingException, AttachmentNotFoundException, ParseException, JsonProcessingException, InlineAttachmentProcessingException, - SAXException, TransformerException, InstantiationException, IllegalAccessException { + SAXException, TransformerException { Bundle bundle = new Bundle(); bundle.setId("Test"); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/CompoundStatementUtilTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/CompoundStatementUtilTest.java index 4e104f7f3..f7910a43b 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/CompoundStatementUtilTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/CompoundStatementUtilTest.java @@ -66,7 +66,7 @@ public void When_CompoundStatementContainsMedicationStatements_Expect_AllMedicat RCMRMT030101UKComponent02::hasMedicationStatement, RCMRMT030101UKComponent02::getMedicationStatement); - assertThat(mappedValues.size()).isEqualTo(EXPECTED_MEDICATION_STATEMENT_COUNT); + assertThat(mappedValues).hasSize(EXPECTED_MEDICATION_STATEMENT_COUNT); mappedValues.forEach( value -> assertTrue(value instanceof RCMRMT030101UKMedicationStatement) ); @@ -80,7 +80,7 @@ public void When_CompoundStatementContainsObservationStatements_Expect_AllMedica RCMRMT030101UKComponent02::hasObservationStatement, RCMRMT030101UKComponent02::getObservationStatement); - assertThat(mappedValues.size()).isEqualTo(EXPECTED_OBSERVATION_STATEMENT_COUNT); + assertThat(mappedValues).hasSize(EXPECTED_OBSERVATION_STATEMENT_COUNT); mappedValues.forEach( value -> assertTrue(value instanceof RCMRMT030101UKObservationStatement) ); @@ -94,7 +94,7 @@ public void When_CompoundStatementContainsLinkSets_Expect_AllLinkSetsExtracted() RCMRMT030101UKComponent02::hasLinkSet, RCMRMT030101UKComponent02::getLinkSet); - assertThat(mappedValues.size()).isEqualTo(EXPECTED_LINKSET_COUNT); + assertThat(mappedValues).hasSize(EXPECTED_LINKSET_COUNT); mappedValues.forEach( value -> assertTrue(value instanceof RCMRMT030101UKLinkSet) ); diff --git a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/ObservationUtilTest.java b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/ObservationUtilTest.java index 56b5dad4a..f1196e3dd 100644 --- a/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/ObservationUtilTest.java +++ b/gp2gp-translator/src/test/java/uk/nhs/adaptors/pss/translator/util/ObservationUtilTest.java @@ -23,7 +23,6 @@ public class ObservationUtilTest { private static final String XML_RESOURCES_BASE = "xml/Observation/"; private static final String ISSUED_EHR_COMPOSITION_EXAMPLE = "2020-01-01T01:01:01.000+00:00"; - private static final String ISSUED_EHR_EXTRACT_EXAMPLE = "2020-02-01T01:01:01.000+00:00"; private static final String INTERPRETATION_SYSTEM = "http://hl7.org/fhir/v2/0078"; private static final String EFFECTIVE_START_DATE_1 = "2010-05-21"; private static final String EFFECTIVE_START_DATE_2 = "2010-05-20"; diff --git a/gpc-api-facade/src/test/java/uk/nhs/adaptors/pss/gpc/controller/PatientTransferControllerTest.java b/gpc-api-facade/src/test/java/uk/nhs/adaptors/pss/gpc/controller/PatientTransferControllerTest.java index 8ca33ab8c..6c71f9217 100644 --- a/gpc-api-facade/src/test/java/uk/nhs/adaptors/pss/gpc/controller/PatientTransferControllerTest.java +++ b/gpc-api-facade/src/test/java/uk/nhs/adaptors/pss/gpc/controller/PatientTransferControllerTest.java @@ -53,7 +53,6 @@ public class PatientTransferControllerTest { TO_ODS, TO_ODS_VALUE, FROM_ODS, FROM_ODS_VALUE ); - private static final String ISSUE_SYSTEM = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"; @Mock private PatientTransferService patientTransferService;