Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class IntegrationAdaptorNhaisApplicationTests {

@Test
void when_databaseIsNotReachable_then_applicationStartsUpWithNegativeHealthcheck() {
void When_DatabaseIsNotReachable_Expect_ApplicationStartsUpWithNegativeHealthcheck() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void setUp() {
}

@Test
void whenTranslatingAmendment_expectPatchTranslationServiceIsUsed() {
void When_TranslatingAmendment_Expect_PatchTranslationServiceIsUsed() {
when(message.getReferenceTransactionType())
.thenReturn(new ReferenceTransactionType(ReferenceTransactionType.Inbound.AMENDMENT));
var amendmentBody = new AmendmentBody();
Expand All @@ -59,7 +59,7 @@ void whenTranslatingAmendment_expectPatchTranslationServiceIsUsed() {

@ParameterizedTest
@EnumSource(names = {"DEDUCTION", "REJECTION", "APPROVAL"})
void whenTranslatingNonAmendment_expectFhirTranslationServiceIsUsed(ReferenceTransactionType.Inbound transactionType) {
void When_TranslatingNonAmendment_Expect_FhirTranslationServiceIsUsed(ReferenceTransactionType.Inbound transactionType) {
when(message.getReferenceTransactionType())
.thenReturn(new ReferenceTransactionType(transactionType));
var parameters = new Parameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ private void beforeEach() {

@ParameterizedTest
@EnumSource(value = ReferenceTransactionType.Inbound.class, names = {"APPROVAL", "REJECTION"})
public void When_ApprovalOrRejectionTransaction_Then_OperationIdUsesRecipient(ReferenceTransactionType.Inbound transactionType) {
public void When_ApprovalOrRejectionTransaction_Expect_OperationIdUsesRecipient(ReferenceTransactionType.Inbound transactionType) {
when(referenceTransactionType.getTransactionType()).thenReturn(transactionType);
when(interchangeHeader.getRecipient()).thenReturn(RECIPIENT);
assertThat(RECIPIENT_OID).isEqualTo(operationIdService.createOperationIdForTransaction(transaction));
}

@ParameterizedTest
@EnumSource(value = ReferenceTransactionType.Inbound.class, names = {"APPROVAL", "REJECTION"}, mode = EnumSource.Mode.EXCLUDE)
public void When_AllOtherTransactions_Then_OperationIdUsesSender(ReferenceTransactionType.Inbound transactionType) {
public void When_AllOtherTransactions_Expect_OperationIdUsesSender(ReferenceTransactionType.Inbound transactionType) {
when(referenceTransactionType.getTransactionType()).thenReturn(transactionType);
when(interchangeHeader.getSender()).thenReturn(SENDER);
assertThat(SENDER_OID).isEqualTo(operationIdService.createOperationIdForTransaction(transaction));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class RecepProducerServiceTest {
private TimestampService timestampService;

@Test
public void whenProducingRecep_thenValidRecepIsCreated() throws IOException {
public void When_ProducingRecep_Expect_ValidRecepIsCreated() throws IOException {
when(timestampService.getCurrentTimestamp()).thenReturn(FIXED_TIME);
when(sequenceService.generateInterchangeSequence(REF_SENDER, REF_RECIPIENT)).thenReturn(RECEP_INTERCHANGE_SEQUENCE);
when(sequenceService.generateMessageSequence(REF_SENDER, REF_RECIPIENT)).thenReturn(RECEP_MESSAGE_SEQUENCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DeductionRejectionTransactionMapperTest {
private GpNameAndAddress gpNameAndAddress;

@Test
void when_AllDataPresent_then_mapped(SoftAssertions softly) {
void When_AllDataPresent_Expect_Mapped(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(personName.getNhsNumber()).thenReturn(NHS_NUMBER);
when(transaction.getFreeText()).thenReturn(Optional.of(new FreeText("TEXT VALUE")));
Expand All @@ -78,7 +78,7 @@ void when_AllDataPresent_then_mapped(SoftAssertions softly) {
}

@Test
void when_missingOfficialPatientIdentifier_then_throwsException() {
void When_MissingOfficialPatientIdentifier_Expect_ThrowsException() {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(personName.getNhsNumber()).thenReturn(null);
when(transaction.getMessage()).thenReturn(message);
Expand All @@ -94,7 +94,7 @@ void when_missingOfficialPatientIdentifier_then_throwsException() {
}

@Test
void when_missingPersonNameSegment_then_throwsException() {
void When_MissingPersonNameSegment_Expect_ThrowsException() {
when(transaction.getPersonName()).thenReturn(Optional.empty());
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
Expand All @@ -109,7 +109,7 @@ void when_missingPersonNameSegment_then_throwsException() {
}

@Test
void when_missingHaNotes_then_throwsException() {
void When_MissingHaNotes_Expect_ThrowsException() {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(personName.getNhsNumber()).thenReturn(NHS_NUMBER);
when(transaction.getFreeText()).thenReturn(Optional.empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DeductionTransactionMapperTest {
private GpNameAndAddress gpNameAndAddress;

@Test
void when_allFieldsInTransaction_Then_mapAllFields(SoftAssertions softly) {
void When_AllFieldsInTransaction_Expect_MapAllFields(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(transaction.getDeductionReasonCode()).thenReturn(Optional.of(deductionReasonCode));
when(transaction.getDeductionDate()).thenReturn(Optional.of(deductionDate));
Expand Down Expand Up @@ -91,7 +91,7 @@ void when_allFieldsInTransaction_Then_mapAllFields(SoftAssertions softly) {
}

@Test
void when_allMandatoryFieldsInTransaction_Then_mapOnlyMandatoryFields(SoftAssertions softly) {
void When_AllMandatoryFieldsInTransaction_Expect_MapOnlyMandatoryFields(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(transaction.getDeductionReasonCode()).thenReturn(Optional.of(deductionReasonCode));
when(transaction.getDeductionDate()).thenReturn(Optional.of(deductionDate));
Expand Down Expand Up @@ -119,7 +119,7 @@ void when_allMandatoryFieldsInTransaction_Then_mapOnlyMandatoryFields(SoftAssert
}

@Test
void when_NhsNumberIsMissing_Then_ThrowException(SoftAssertions softly) {
void When_NhsNumberIsMissing_Expect_ThrowException(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.empty());
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
Expand All @@ -133,7 +133,7 @@ void when_NhsNumberIsMissing_Then_ThrowException(SoftAssertions softly) {
}

@Test
void when_DeductionReasonCodeIsMissing_Then_ThrowException(SoftAssertions softly) {
void When_DeductionReasonCodeIsMissing_Expect_ThrowException(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(transaction.getDeductionReasonCode()).thenReturn(Optional.empty());
when(transaction.getMessage()).thenReturn(message);
Expand All @@ -150,7 +150,7 @@ void when_DeductionReasonCodeIsMissing_Then_ThrowException(SoftAssertions softly
}

@Test
void when_DeductionDateIsMissing_Then_ThrowException(SoftAssertions softly) {
void When_DeductionDateIsMissing_Expect_ThrowException(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(transaction.getDeductionReasonCode()).thenReturn(Optional.of(deductionReasonCode));
when(transaction.getDeductionDate()).thenReturn(Optional.empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class FP69FlagRemovalTransactionMapperTest {
private GpNameAndAddress gpNameAndAddress;

@Test
void when_AllDataPresent_then_mapped(SoftAssertions softly) {
void When_AllDataPresent_Expect_Mapped(SoftAssertions softly) {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(personName.getNhsNumber()).thenReturn(NHS_NUMBER);
when(transaction.getMessage()).thenReturn(message);
Expand All @@ -76,7 +76,7 @@ void when_AllDataPresent_then_mapped(SoftAssertions softly) {
}

@Test
void when_missingOfficialPatientIdentifier_then_throwsException() {
void When_MissingOfficialPatientIdentifier_Expect_ThrowsException() {
when(transaction.getPersonName()).thenReturn(Optional.of(personName));
when(personName.getNhsNumber()).thenReturn(null);
when(transaction.getMessage()).thenReturn(message);
Expand All @@ -91,7 +91,7 @@ void when_missingOfficialPatientIdentifier_then_throwsException() {
}

@Test
void when_missingPersonNameSegment_then_throwsException() {
void When_MissingPersonNameSegment_Expect_ThrowsException() {
when(transaction.getPersonName()).thenReturn(Optional.empty());
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FP69PriorNotificationTransactionMapperTest {
private GpNameAndAddress gpNameAndAddress;

@Test
void whenPersonNameSegmentIsMissing_expectException() {
void When_PersonNameSegmentIsMissing_Expect_Exception() {
when(transaction.getPersonName()).thenReturn(Optional.empty());
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
Expand All @@ -83,7 +83,7 @@ void whenPersonNameSegmentIsMissing_expectException() {
}

@Test
void whenNhsNumberIsMissing_expectException() {
void When_NhsNumberIsMissing_Expect_Exception() {
when(transaction.getPersonName()).thenReturn(Optional.of(PersonName.builder().build()));
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
Expand All @@ -97,7 +97,7 @@ void whenNhsNumberIsMissing_expectException() {
}

@Test
void whenSurnameIsMissing_expectException() {
void When_SurnameIsMissing_Expect_Exception() {
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
when(message.getInterchange()).thenReturn(interchange);
Expand All @@ -113,7 +113,7 @@ void whenSurnameIsMissing_expectException() {
}

@Test
void whenDateOfBirthSegmentIsMissing_expectException() {
void When_DateOfBirthSegmentIsMissing_Expect_Exception() {
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
when(message.getInterchange()).thenReturn(interchange);
Expand All @@ -131,7 +131,7 @@ void whenDateOfBirthSegmentIsMissing_expectException() {
}

@Test
void whenReasonCodeSegmentIsMissing_expectException() {
void When_ReasonCodeSegmentIsMissing_Expect_Exception() {
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
when(message.getInterchange()).thenReturn(interchange);
Expand All @@ -152,7 +152,7 @@ void whenReasonCodeSegmentIsMissing_expectException() {
}

@Test
void whenExpiryDateSegmentIsMissing_expectException() {
void When_ExpiryDateSegmentIsMissing_Expect_Exception() {
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
when(message.getInterchange()).thenReturn(interchange);
Expand All @@ -174,7 +174,7 @@ void whenExpiryDateSegmentIsMissing_expectException() {
}

@Test
void whenMappingRequiredValues_expectParametersAreMapped(SoftAssertions softly) {
void When_MappingRequiredValues_Expect_ParametersAreMapped(SoftAssertions softly) {
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
when(message.getInterchange()).thenReturn(interchange);
Expand All @@ -189,7 +189,7 @@ void whenMappingRequiredValues_expectParametersAreMapped(SoftAssertions softly)
}

@Test
void whenMappingAllValues_expectParametersAreMapped(SoftAssertions softly) {
void When_MappingAllValues_Expect_ParametersAreMapped(SoftAssertions softly) {
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
when(message.getInterchange()).thenReturn(interchange);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void testMap(SoftAssertions softly) {
}

@Test
void whenFreeTextIsMissing_expectException(SoftAssertions softly) {
void When_FreeTextIsMissing_Expect_Exception(SoftAssertions softly) {
when(transaction.getFreeText()).thenReturn(Optional.empty());
when(transaction.getMessage()).thenReturn(message);
when(transaction.getGpNameAndAddress()).thenReturn(gpNameAndAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void setUp() {
}

@Test
void whenConvertingToPatch_properMandatoryFieldsAreSet() {
void When_ConvertingToPatch_Expect_ProperMandatoryFieldsAreSet() {
var amendmentBody = edifactToPatchService.convertToPatch(transaction);

assertThat(amendmentBody.getNhsNumber()).isEqualTo(NHS_NUMBER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void setUp() {


@Test
void whenPersonAddressHasLineFifth_thenMapIntoCountyAmendmentPatch() {
void When_PersonAddressHasLineFifth_Expect_MapIntoCountyAmendmentPatch() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine5()).thenReturn(COUNTY);

Expand All @@ -45,7 +45,7 @@ void whenPersonAddressHasLineFifth_thenMapIntoCountyAmendmentPatch() {
}

@Test
void whenPersonAddressNotPresent_thenReturnNull() {
void When_PersonAddressNotPresent_Expect_ReturnNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.empty());

AmendmentPatch amendmentPatch = addressCountyPatchTransactionMapper.map(transaction);
Expand All @@ -54,7 +54,7 @@ void whenPersonAddressNotPresent_thenReturnNull() {
}

@Test
void whenPersonAddressHasNoLineFifth_thenReturnValueIsNull() {
void When_PersonAddressHasNoLineFifth_Expect_ReturnValueIsNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine5()).thenReturn(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void setUp() {
}

@Test
void whenPersonAddressHasLineFirst_theMapIntoHouseNameAmendmentPatch() {
void When_PersonAddressHasLineFirst_Expect_MapIntoHouseNameAmendmentPatch() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine1()).thenReturn(HOUSE_NAME);

Expand All @@ -45,7 +45,7 @@ void whenPersonAddressHasLineFirst_theMapIntoHouseNameAmendmentPatch() {
}

@Test
void whenPersonAddressNotPresent_thenReturnNull() {
void When_PersonAddressNotPresent_Expect_ReturnNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.empty());

AmendmentPatch amendmentPatch = addressHouseNamePatchTransactionMapper.map(transaction);
Expand All @@ -54,7 +54,7 @@ void whenPersonAddressNotPresent_thenReturnNull() {
}

@Test
void whenPersonAddressHasNoLineFirst_thenReturnValueIsNull() {
void When_PersonAddressHasNoLineFirst_Expect_ReturnValueIsNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine1()).thenReturn(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void setUp() {


@Test
void whenPersonAddressHasLineThird_thenMapIntoLocalityAmendmentPatch() {
void When_PersonAddressHasLineThird_Expect_MapIntoLocalityAmendmentPatch() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine3()).thenReturn(LOCALITY);

Expand All @@ -46,7 +46,7 @@ void whenPersonAddressHasLineThird_thenMapIntoLocalityAmendmentPatch() {
}

@Test
void whenPersonAddressNotPresent_thenReturnNull() {
void When_PersonAddressNotPresent_Expect_ReturnNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.empty());

AmendmentPatch amendmentPatch = addressLocalityPatchTransactionMapper.map(transaction);
Expand All @@ -55,7 +55,7 @@ void whenPersonAddressNotPresent_thenReturnNull() {
}

@Test
void whenPersonAddressHasNoLineThird_thenReturnValueIsNull() {
void When_PersonAddressHasNoLineThird_Expect_ReturnValueIsNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine3()).thenReturn(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void setUp() {


@Test
void whenPersonAddressHasLineSecond_thenMapIntoAddressNumberOrRoadNameAmendmentPatch() {
void When_PersonAddressHasLineSecond_Expect_MapIntoAddressNumberOrRoadNameAmendmentPatch() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine2()).thenReturn(ROAD_NAME);

Expand All @@ -47,7 +47,7 @@ void whenPersonAddressHasLineSecond_thenMapIntoAddressNumberOrRoadNameAmendmentP
}

@Test
void whenPersonAddressNotPresent_thenReturnNull() {
void When_PersonAddressNotPresent_Expect_ReturnNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.empty());

AmendmentPatch amendmentPatch = addressNumberOrRoadNamePatchTransactionMapper.map(transaction);
Expand All @@ -56,7 +56,7 @@ void whenPersonAddressNotPresent_thenReturnNull() {
}

@Test
void whenPersonAddressHasNoLineSecond_thenReturnValueIsNull() {
void When_PersonAddressHasNoLineSecond_Expect_ReturnValueIsNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getAddressLine2()).thenReturn(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void setUp() {


@Test
void whenPersonAddressHasLineFifth_thenMapIntoCountyAmendmentPatch() {
void When_PersonAddressHasLineFifth_Expect_MapIntoCountyAmendmentPatch() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getPostalCode()).thenReturn(POST_CODE);

Expand All @@ -46,7 +46,7 @@ void whenPersonAddressHasLineFifth_thenMapIntoCountyAmendmentPatch() {
}

@Test
void whenPersonAddressNotPresent_thenReturnNull() {
void When_PersonAddressNotPresent_Expect_ReturnNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.empty());

AmendmentPatch amendmentPatch = addressPostCodePatchTransactionMapper.map(transaction);
Expand All @@ -55,7 +55,7 @@ void whenPersonAddressNotPresent_thenReturnNull() {
}

@Test
void whenPersonAddressHasNoLineFifth_thenAmendmentPatchIsNull() {
void When_PersonAddressHasNoLineFifth_Expect_AmendmentPatchIsNull() {
when(transaction.getPersonAddress()).thenReturn(Optional.of(personAddress));
when(personAddress.getPostalCode()).thenReturn(null);

Expand Down
Loading