Skip to content

Commit 4832866

Browse files
authored
removing excessive code (#1349)
1 parent d445883 commit 4832866

File tree

74 files changed

+516
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+516
-516
lines changed

e2e-tests/src/test/java/uk/nhs/adaptors/gp2gp/e2e/EhrExtractTest.java

Lines changed: 47 additions & 47 deletions
Large diffs are not rendered by default.

service/src/test/java/uk/nhs/adaptors/gp2gp/common/configuration/ObjectMapperBeanTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
import static org.assertj.core.api.Assertions.assertThat;
88

9-
public class ObjectMapperBeanTest {
9+
class ObjectMapperBeanTest {
1010

1111
@Test
12-
public void createsObjectMapperWithUnlimitedStringLengthConstraint() {
12+
void createsObjectMapperWithUnlimitedStringLengthConstraint() {
1313
// The way we use JSON to store serialized XML and base64 encoded attachments means that the size of individual
1414
// strings can get very large. We've set the max string size below to be 2GB.
1515
// Ideal solution would be to avoid using JSON to store very large strings of data in the first place,

service/src/test/java/uk/nhs/adaptors/gp2gp/common/configuration/RedactionsContextTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import static uk.nhs.adaptors.gp2gp.common.configuration.RedactionsContext.NON_REDACTION_INTERACTION_ID;
1010
import static uk.nhs.adaptors.gp2gp.common.configuration.RedactionsContext.REDACTION_INTERACTION_ID;
1111

12-
public class RedactionsContextTest {
12+
class RedactionsContextTest {
1313

1414
@Test
15-
public void When_IsRedactionMessageAndInteractionIdIsRCMRIN030000UK07_Expect_IsRedactionMessage() {
15+
void When_IsRedactionMessageAndInteractionIdIsRCMRIN030000UK07_Expect_IsRedactionMessage() {
1616
final var redactionsContext = new RedactionsContext(REDACTION_INTERACTION_ID);
1717

1818
final var isRedactionMessage = redactionsContext.isRedactionMessage();
@@ -23,7 +23,7 @@ public void When_IsRedactionMessageAndInteractionIdIsRCMRIN030000UK07_Expect_IsR
2323
@ParameterizedTest
2424
@ValueSource(strings = { NON_REDACTION_INTERACTION_ID })
2525
@NullAndEmptySource
26-
public void When_IsRedactionMessageAndInteractionIdIsNotRCMRIN030000UK07_Expect_IsNotRedactionMessage(
26+
void When_IsRedactionMessageAndInteractionIdIsNotRCMRIN030000UK07_Expect_IsNotRedactionMessage(
2727
String interactionId
2828
) {
2929
final var redactionsContext = new RedactionsContext(interactionId);

service/src/test/java/uk/nhs/adaptors/gp2gp/common/service/ConfidentialityServiceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static uk.nhs.adaptors.gp2gp.common.configuration.RedactionsContext.REDACTION_INTERACTION_ID;
2424

2525
@ExtendWith(MockitoExtension.class)
26-
public class ConfidentialityServiceTest {
26+
class ConfidentialityServiceTest {
2727
private static final Meta META_WITH_NO_SECURITY = new Meta();
2828
private static final Meta META_WITH_NOPAT_SECURITY = new Meta()
2929
.addSecurity(
@@ -49,7 +49,7 @@ private static Stream<Arguments> When_GenerateAndIsNotRedactionMessage_Expect_Em
4949
@ParameterizedTest
5050
@MethodSource
5151
@NullSource
52-
public void When_GenerateAndIsNotRedactionMessage_Expect_EmptyOptional(Meta meta) {
52+
void When_GenerateAndIsNotRedactionMessage_Expect_EmptyOptional(Meta meta) {
5353
var confidentialityService = new ConfidentialityService(
5454
new RedactionsContext(NON_REDACTION_INTERACTION_ID)
5555
);
@@ -62,7 +62,7 @@ public void When_GenerateAndIsNotRedactionMessage_Expect_EmptyOptional(Meta meta
6262
}
6363

6464
@Test
65-
public void When_GenerateAndIsRedactionMessageAndNoMetaSecurityIsPresent_Expect_EmptyOptional() {
65+
void When_GenerateAndIsRedactionMessageAndNoMetaSecurityIsPresent_Expect_EmptyOptional() {
6666
var confidentialityService = new ConfidentialityService(
6767
new RedactionsContext(REDACTION_INTERACTION_ID)
6868
);
@@ -75,7 +75,7 @@ public void When_GenerateAndIsRedactionMessageAndNoMetaSecurityIsPresent_Expect_
7575
}
7676

7777
@Test
78-
public void When_GenerateAndIsRedactionMessageAndNonNOPATMetaSecurityIsPresent_Expect_EmptyOptional() {
78+
void When_GenerateAndIsRedactionMessageAndNonNOPATMetaSecurityIsPresent_Expect_EmptyOptional() {
7979
var confidentialityService = new ConfidentialityService(
8080
new RedactionsContext(REDACTION_INTERACTION_ID)
8181
);
@@ -88,7 +88,7 @@ public void When_GenerateAndIsRedactionMessageAndNonNOPATMetaSecurityIsPresent_E
8888
}
8989

9090
@Test
91-
public void When_GenerateAndIsRedactionMessageAndNOPATMetaSecurityIsPresent_Expect_ConfidentialityCode() {
91+
void When_GenerateAndIsRedactionMessageAndNOPATMetaSecurityIsPresent_Expect_ConfidentialityCode() {
9292
var confidentialityService = new ConfidentialityService(
9393
new RedactionsContext(REDACTION_INTERACTION_ID)
9494
);

service/src/test/java/uk/nhs/adaptors/gp2gp/common/service/ProcessFailureHandlingServiceTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import static org.mockito.Mockito.verifyNoInteractions;
2222

2323
@ExtendWith(MockitoExtension.class)
24-
public class ProcessFailureHandlingServiceTest {
24+
class ProcessFailureHandlingServiceTest {
2525

2626
@Mock
2727
private EhrExtractStatusRepository ehrExtractStatusRepository;
@@ -42,7 +42,7 @@ public class ProcessFailureHandlingServiceTest {
4242
private ProcessFailureHandlingService processFailureHandlingService;
4343

4444
@Test
45-
public void When_EhrExtractStatusExistsInDB_Expect_FailProcessToReturnTrue() {
45+
void When_EhrExtractStatusExistsInDB_Expect_FailProcessToReturnTrue() {
4646
var conversationId = "conversationId1";
4747
var errorCode = "errorCode1";
4848
var errorMessage = "errorMessage1";
@@ -59,7 +59,7 @@ public void When_EhrExtractStatusExistsInDB_Expect_FailProcessToReturnTrue() {
5959
}
6060

6161
@Test
62-
public void When_EhrExtractStatusNotInDB_Expect_FailProcessToReturnFalse() {
62+
void When_EhrExtractStatusNotInDB_Expect_FailProcessToReturnFalse() {
6363
doReturn(Optional.empty()).when(ehrExtractStatusRepository).findByConversationId(any());
6464

6565
var result = processFailureHandlingService.failProcess("convId1", "errorCode1", "errorMsg1", "taskType1");
@@ -69,7 +69,7 @@ public void When_EhrExtractStatusNotInDB_Expect_FailProcessToReturnFalse() {
6969
}
7070

7171
@Test
72-
public void When_ExceptionIsThrown_Expect_FailProcessToReturnFalse() {
72+
void When_ExceptionIsThrown_Expect_FailProcessToReturnFalse() {
7373
doThrow(new RuntimeException("test exception")).when(ehrExtractStatusRepository).findByConversationId(any());
7474

7575
var result = processFailureHandlingService.failProcess("convId1", "errorCode1", "errorMsg1", "taskType1");
@@ -78,7 +78,7 @@ public void When_ExceptionIsThrown_Expect_FailProcessToReturnFalse() {
7878
}
7979

8080
@Test
81-
public void When_EhrExtractStatusNotInDB_Expect_HasProcessFailedToReturnFalse() {
81+
void When_EhrExtractStatusNotInDB_Expect_HasProcessFailedToReturnFalse() {
8282
doReturn(Optional.of(ehrExtractStatus)).when(ehrExtractStatusRepository).findByConversationId(any());
8383

8484
var result = processFailureHandlingService.hasProcessFailed("conversationId1");
@@ -87,7 +87,7 @@ public void When_EhrExtractStatusNotInDB_Expect_HasProcessFailedToReturnFalse()
8787
}
8888

8989
@Test
90-
public void When_ErrorInEhrExtractStatusIsMissing_Expect_HasProcessFailedToReturnFalse() {
90+
void When_ErrorInEhrExtractStatusIsMissing_Expect_HasProcessFailedToReturnFalse() {
9191
doReturn(null).when(ehrExtractStatus).getError();
9292
doReturn(Optional.of(ehrExtractStatus)).when(ehrExtractStatusRepository).findByConversationId(any());
9393

@@ -97,7 +97,7 @@ public void When_ErrorInEhrExtractStatusIsMissing_Expect_HasProcessFailedToRetur
9797
}
9898

9999
@Test
100-
public void When_ErrorInEhrExtractStatusIsPresent_Expect_HasProcessFailedToReturnTrue() {
100+
void When_ErrorInEhrExtractStatusIsPresent_Expect_HasProcessFailedToReturnTrue() {
101101
doReturn(ehrExtractStatusError).when(ehrExtractStatus).getError();
102102
doReturn(Optional.of(ehrExtractStatus)).when(ehrExtractStatusRepository).findByConversationId(any());
103103

@@ -107,7 +107,7 @@ public void When_ErrorInEhrExtractStatusIsPresent_Expect_HasProcessFailedToRetur
107107
}
108108

109109
@Test
110-
public void When_EhrExtractStatusRepositoryFails_Expect_HasProcessFailedToThrowException() {
110+
void When_EhrExtractStatusRepositoryFails_Expect_HasProcessFailedToThrowException() {
111111
var expectedException = new RuntimeException("test exception");
112112
doThrow(expectedException).when(ehrExtractStatusRepository).findByConversationId(any());
113113

service/src/test/java/uk/nhs/adaptors/gp2gp/common/service/RandomIdGeneratorServiceTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
import org.junit.jupiter.api.Test;
99

10-
public class RandomIdGeneratorServiceTest {
10+
class RandomIdGeneratorServiceTest {
1111

1212
private static final String UUID_UPPERCASE_REGEXP = "[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}";
1313

1414
@Test
15-
public void When_CreatingNewId_Expect_GeneratedIdIsRandomUUID() {
15+
void When_CreatingNewId_Expect_GeneratedIdIsRandomUUID() {
1616
String id1 = new RandomIdGeneratorService().createNewId();
1717
String id2 = new RandomIdGeneratorService().createNewId();
1818

@@ -24,7 +24,7 @@ public void When_CreatingNewId_Expect_GeneratedIdIsRandomUUID() {
2424
}
2525

2626
@Test
27-
public void When_GeneratingIdFromExistingId_And_IdIsAValidUUID_Expect_ThatUUIDIsUsed() {
27+
void When_GeneratingIdFromExistingId_And_IdIsAValidUUID_Expect_ThatUUIDIsUsed() {
2828
var uuidString = UUID.randomUUID().toString();
2929

3030
var generatedUUID = new RandomIdGeneratorService().createNewOrUseExistingUUID(uuidString);
@@ -33,7 +33,7 @@ public void When_GeneratingIdFromExistingId_And_IdIsAValidUUID_Expect_ThatUUIDIs
3333
}
3434

3535
@Test
36-
public void When_GeneratingIdFromExistingId_And_IdIsNotAValidUUID_Expect_NewUUIDIsGenerated() {
36+
void When_GeneratingIdFromExistingId_And_IdIsNotAValidUUID_Expect_NewUUIDIsGenerated() {
3737
var idString = "THIS-IS-NOT-A-VALID-GUID";
3838

3939
var generatedUUID = new RandomIdGeneratorService().createNewOrUseExistingUUID(idString);

service/src/test/java/uk/nhs/adaptors/gp2gp/common/service/TimestampServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
import org.junit.jupiter.api.Test;
99

10-
public class TimestampServiceTest {
10+
class TimestampServiceTest {
1111

1212
private static final int MILLIS_PER_MICRO = 1000;
1313

1414
@Test
15-
public void When_TimestampIsCreated_Expect_TruncatedToMilliseconds() {
15+
void When_TimestampIsCreated_Expect_TruncatedToMilliseconds() {
1616
Instant now = new TimestampService().now();
1717
assertThat(now.getLong(ChronoField.MICRO_OF_SECOND) % MILLIS_PER_MICRO).isZero();
1818
}

service/src/test/java/uk/nhs/adaptors/gp2gp/common/service/XPathServiceTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,33 @@
1010

1111
import lombok.SneakyThrows;
1212

13-
public class XPathServiceTest {
13+
class XPathServiceTest {
1414

1515
@Test
1616
@SneakyThrows
17-
public void When_ValidXmlIsParsed_Expect_DocumentIsReturned() {
17+
void When_ValidXmlIsParsed_Expect_DocumentIsReturned() {
1818
var document = new XPathService().parseDocumentFromXml("<root/>");
1919
assertThat(document.getChildNodes().item(0).getNodeName()).isEqualTo("root");
2020
}
2121

2222
@Test
2323
@SneakyThrows
24-
public void When_InvalidXmlIsParsed_Expect_SAXExceptionIsThrown() {
24+
void When_InvalidXmlIsParsed_Expect_SAXExceptionIsThrown() {
2525
assertThatExceptionOfType(SAXException.class)
2626
.isThrownBy(() -> new XPathService().parseDocumentFromXml("NOT XML"));
2727
}
2828

2929
@Test
3030
@SneakyThrows
31-
public void When_GetNodeValueWithValidXPath_Expect_TheValueIsReturned() {
31+
void When_GetNodeValueWithValidXPath_Expect_TheValueIsReturned() {
3232
var document = new XPathService().parseDocumentFromXml("<element>value</element>");
3333
assertThat(new XPathService().getNodeValue(document, "/element"))
3434
.isEqualTo("value");
3535
}
3636

3737
@Test
3838
@SneakyThrows
39-
public void When_GetNodeValueWithInvalidXPath_Expect_ThrowsRuntimeException() {
39+
void When_GetNodeValueWithInvalidXPath_Expect_ThrowsRuntimeException() {
4040
var document = new XPathService().parseDocumentFromXml("<element>value</element>");
4141
assertThatExceptionOfType(IllegalArgumentException.class)
4242
.isThrownBy(() -> new XPathService().getNodeValue(document, "!!!NOT XPATH"))
@@ -45,7 +45,7 @@ public void When_GetNodeValueWithInvalidXPath_Expect_ThrowsRuntimeException() {
4545

4646
@Test
4747
@SneakyThrows
48-
public void When_GetNodesWithValidXPath_Expect_NodeListReturned() {
48+
void When_GetNodesWithValidXPath_Expect_NodeListReturned() {
4949
var document = new XPathService().parseDocumentFromXml("<elements><element>value</element><element>value2</element></elements>");
5050
NodeList nodes = new XPathService().getNodes(document, "//element");
5151
assertAll(

service/src/test/java/uk/nhs/adaptors/gp2gp/common/storage/StorageConnectorServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import lombok.SneakyThrows;
2323

2424
@ExtendWith(MockitoExtension.class)
25-
public class StorageConnectorServiceTest {
25+
class StorageConnectorServiceTest {
2626
private static final String TEST_ID = "SOME_ID";
2727
private static final long EXPECTED_STREAM_LENGTH = 8;
2828

@@ -40,7 +40,7 @@ public class StorageConnectorServiceTest {
4040

4141
@Test
4242
@SneakyThrows
43-
public void When_ValidStorageDataWrapperIsPass_Expect_UploadStorageParamsHaveCorrectValues() {
43+
void When_ValidStorageDataWrapperIsPass_Expect_UploadStorageParamsHaveCorrectValues() {
4444
when(objectMapper.writeValueAsString(anyStorageDataWrapper)).thenReturn("response");
4545

4646
String filename = TEST_ID.concat("/").concat(TEST_ID).concat("_gpc_structured.json");

service/src/test/java/uk/nhs/adaptors/gp2gp/common/task/TaskConsumerTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import uk.nhs.adaptors.gp2gp.mhs.exception.MhsConnectionException;
2323

2424
@ExtendWith(MockitoExtension.class)
25-
public class TaskConsumerTest {
25+
class TaskConsumerTest {
2626

2727
@Mock
2828
private TaskHandler taskHandler;
@@ -41,7 +41,7 @@ public class TaskConsumerTest {
4141

4242
@Test
4343
@SneakyThrows
44-
public void When_TaskHandlerReturnsTrue_Expect_MessageAcknowledged() {
44+
void When_TaskHandlerReturnsTrue_Expect_MessageAcknowledged() {
4545
when(taskHandler.handle(any())).thenReturn(true);
4646

4747
taskConsumer.receive(message, session);
@@ -52,7 +52,7 @@ public void When_TaskHandlerReturnsTrue_Expect_MessageAcknowledged() {
5252

5353
@Test
5454
@SneakyThrows
55-
public void When_TaskHandlerReturnsFalse_Expect_MessageNotAcknowledged() {
55+
void When_TaskHandlerReturnsFalse_Expect_MessageNotAcknowledged() {
5656
when(taskHandler.handle(any())).thenReturn(false);
5757

5858
taskConsumer.receive(message, session);
@@ -63,7 +63,7 @@ public void When_TaskHandlerReturnsFalse_Expect_MessageNotAcknowledged() {
6363

6464
@Test
6565
@SneakyThrows
66-
public void When_TaskHandlerReturnsFalse_Expect_SessionRolledBack() {
66+
void When_TaskHandlerReturnsFalse_Expect_SessionRolledBack() {
6767
when(taskHandler.handle(any())).thenReturn(false);
6868

6969
taskConsumer.receive(message, session);
@@ -74,7 +74,7 @@ public void When_TaskHandlerReturnsFalse_Expect_SessionRolledBack() {
7474

7575
@Test
7676
@SneakyThrows
77-
public void When_TaskHandlerThrowsException_Expect_MessageNotAcknowledged() {
77+
void When_TaskHandlerThrowsException_Expect_MessageNotAcknowledged() {
7878
doThrow(RuntimeException.class).when(taskHandler).handle(message);
7979

8080
taskConsumer.receive(message, session);
@@ -85,7 +85,7 @@ public void When_TaskHandlerThrowsException_Expect_MessageNotAcknowledged() {
8585

8686
@Test
8787
@SneakyThrows
88-
public void When_TaskHandlerThrowsException_Expect_SessionRolledBack() {
88+
void When_TaskHandlerThrowsException_Expect_SessionRolledBack() {
8989
doThrow(RuntimeException.class).when(taskHandler).handle(message);
9090

9191
taskConsumer.receive(message, session);
@@ -96,7 +96,7 @@ public void When_TaskHandlerThrowsException_Expect_SessionRolledBack() {
9696

9797
@Test
9898
@SneakyThrows
99-
public void When_TaskHandlerThrowsDataResourceAccessFailureException_Expect_ExceptionIsThrown() {
99+
void When_TaskHandlerThrowsDataResourceAccessFailureException_Expect_ExceptionIsThrown() {
100100
doThrow(DataAccessResourceFailureException.class).when(taskHandler).handle(message);
101101

102102
assertThatExceptionOfType(DataAccessResourceFailureException.class)
@@ -108,7 +108,7 @@ public void When_TaskHandlerThrowsDataResourceAccessFailureException_Expect_Exce
108108

109109
@Test
110110
@SneakyThrows
111-
public void When_TaskHandlerThrowsMhsConnectionException_Expect_ExceptionIsThrown() {
111+
void When_TaskHandlerThrowsMhsConnectionException_Expect_ExceptionIsThrown() {
112112
doThrow(MhsConnectionException.class).when(taskHandler).handle(message);
113113

114114
assertThatExceptionOfType(MhsConnectionException.class)

0 commit comments

Comments
 (0)