Skip to content

Commit fd80c51

Browse files
* Address CheckStyle [VisibilityModifier] issues (Variable '<VariableName>' must be private and have accessor methods.)
1 parent b28544e commit fd80c51

12 files changed

+136
-134
lines changed

src/test/java/uk/nhs/digital/nhsconnect/nhais/inbound/state/InboundStateFactoryTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ public class InboundStateFactoryTest {
6868
.setConversationId(CONVERSATION_ID);
6969

7070
@Mock
71-
TimestampService timestampService;
71+
private TimestampService timestampService;
7272

7373
@Mock
74-
ConversationIdService conversationIdService;
74+
private ConversationIdService conversationIdService;
7575

7676
@Mock
77-
InboundOperationIdService inboundOperationIdService;
77+
private InboundOperationIdService inboundOperationIdService;
7878

7979
@InjectMocks
80-
InboundStateFactory inboundStateFactory;
80+
private InboundStateFactory inboundStateFactory;
8181

8282
@BeforeEach
8383
void setUp() {

src/test/java/uk/nhs/digital/nhsconnect/nhais/model/edifact/GpNameAndAddressTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class GpNameAndAddressTest {
1414

15-
public final GpNameAndAddress gpNameAndAddress = new GpNameAndAddress("ABC", "code1");
15+
private final GpNameAndAddress gpNameAndAddress = new GpNameAndAddress("ABC", "code1");
1616

1717
@Test
1818
void testGetKey() {

src/test/java/uk/nhs/digital/nhsconnect/nhais/model/edifact/HealthAuthorityNameAndAddressTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class HealthAuthorityNameAndAddressTest {
1212

13-
public final HealthAuthorityNameAndAddress healthAuthorityNameAndAddress = new HealthAuthorityNameAndAddress("ABC", "code1");
13+
private final HealthAuthorityNameAndAddress healthAuthorityNameAndAddress = new HealthAuthorityNameAndAddress("ABC", "code1");
1414

1515
@Test
1616
void testGetKey() {

src/test/java/uk/nhs/digital/nhsconnect/nhais/outbound/translator/amendment/mappers/AmendmentAddressToEdifactMapperTest.java

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,24 @@ public class AmendmentAddressToEdifactMapperTest extends AmendmentFhirToEdifactT
3939
@Override
4040
void setUp() {
4141
super.setUp();
42-
lenient().when(amendmentBody.getNhsNumber()).thenReturn(NHS_NUMBER);
42+
lenient().when(super.getAmendmentBody().getNhsNumber()).thenReturn(NHS_NUMBER);
4343
}
4444

4545
@Test
4646
void When_ReplacingAllFiveAddressLinesFields_Expect_AllAddressLinesAreMapped() {
4747
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
48-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
48+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
4949
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
50-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
50+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
5151
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
52-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
52+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
5353
.setOp(operation).setValue(AmendmentValue.from(LOCALITY))));
54-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
54+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
5555
.setOp(operation).setValue(AmendmentValue.from(POST_TOWN))));
56-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
56+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
5757
.setOp(operation).setValue(AmendmentValue.from(COUNTY))));
5858

59-
Optional<Segment> segments = translator.map(amendmentBody);
59+
Optional<Segment> segments = translator.map(super.getAmendmentBody());
6060

6161
assertThat(segments).isNotEmpty().get()
6262
.isEqualTo(PersonAddress.builder()
@@ -71,18 +71,18 @@ void When_ReplacingAllFiveAddressLinesFields_Expect_AllAddressLinesAreMapped() {
7171
@Test
7272
void When_AddressLineIsnull_Expect_NullToBeMapperAsEmptyEdifactString() {
7373
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
74-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
74+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
7575
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
76-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
76+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
7777
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
78-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
78+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
7979
.setOp(operation).setValue(null)));
80-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
80+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
8181
.setOp(operation).setValue(null)));
82-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
82+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
8383
.setOp(operation).setValue(null)));
8484

85-
Optional<Segment> segments = translator.map(amendmentBody);
85+
Optional<Segment> segments = translator.map(super.getAmendmentBody());
8686

8787
assertThat(segments).isNotEmpty().get()
8888
.isEqualTo(PersonAddress.builder()
@@ -97,18 +97,18 @@ void When_AddressLineIsnull_Expect_NullToBeMapperAsEmptyEdifactString() {
9797
@Test
9898
void When_RemovingFourAddressLinesFields_Expect_FourAddressLinesRemoved() {
9999
AmendmentPatchOperation operation = AmendmentPatchOperation.REMOVE;
100-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
100+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
101101
.setOp(operation).setValue(AmendmentValue.from(REMOVE_INDICATOR))));
102-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
102+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
103103
.setOp(operation).setValue(AmendmentValue.from(REMOVE_INDICATOR))));
104-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
104+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
105105
.setOp(operation).setValue(AmendmentValue.from(REMOVE_INDICATOR))));
106-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
106+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
107107
.setOp(AmendmentPatchOperation.REPLACE).setValue(AmendmentValue.from(POST_TOWN))));
108-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
108+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
109109
.setOp(operation).setValue(AmendmentValue.from(REMOVE_INDICATOR))));
110110

111-
Optional<Segment> segments = translator.map(amendmentBody);
111+
Optional<Segment> segments = translator.map(super.getAmendmentBody());
112112

113113
assertThat(segments).isNotEmpty().get()
114114
.isEqualTo(PersonAddress.builder()
@@ -123,108 +123,108 @@ void When_RemovingFourAddressLinesFields_Expect_FourAddressLinesRemoved() {
123123
@Test
124124
void When_HouseNameMissing_Expect_ThrowsFhirValidationException() {
125125
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
126-
when(jsonPatches.getHouseName()).thenReturn(Optional.empty());
127-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
126+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.empty());
127+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
128128
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
129-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
129+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
130130
.setOp(operation).setValue(AmendmentValue.from(LOCALITY))));
131-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
131+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
132132
.setOp(operation).setValue(AmendmentValue.from(POST_TOWN))));
133-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
133+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
134134
.setOp(operation).setValue(AmendmentValue.from(COUNTY))));
135135

136-
assertThatThrownBy(() -> translator.map(amendmentBody))
136+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
137137
.isExactlyInstanceOf(FhirValidationException.class)
138138
.hasMessage(ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE);
139139
}
140140

141141
@Test
142142
void When_NumberOrRoadNameMissing_Expect_ThrowsFhirValidationException() {
143143
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
144-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
144+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
145145
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
146-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.empty());
147-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
146+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.empty());
147+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
148148
.setOp(operation).setValue(AmendmentValue.from(LOCALITY))));
149-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
149+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
150150
.setOp(operation).setValue(AmendmentValue.from(POST_TOWN))));
151-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
151+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
152152
.setOp(operation).setValue(AmendmentValue.from(COUNTY))));
153153

154-
assertThatThrownBy(() -> translator.map(amendmentBody))
154+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
155155
.isExactlyInstanceOf(FhirValidationException.class)
156156
.hasMessage(ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE);
157157
}
158158

159159
@Test
160160
void When_LocalityMissing_Expect_ThrowsFhirValidationException() {
161161
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
162-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
162+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
163163
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
164-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
164+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
165165
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
166-
when(jsonPatches.getLocality()).thenReturn(Optional.empty());
167-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
166+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.empty());
167+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
168168
.setOp(operation).setValue(AmendmentValue.from(POST_TOWN))));
169-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
169+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
170170
.setOp(operation).setValue(AmendmentValue.from(COUNTY))));
171171

172-
assertThatThrownBy(() -> translator.map(amendmentBody))
172+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
173173
.isExactlyInstanceOf(FhirValidationException.class)
174174
.hasMessage(ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE);
175175
}
176176

177177
@Test
178178
void When_PostTownMissing_Expect_ThrowsFhirValidationException() {
179179
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
180-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
180+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
181181
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
182-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
182+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
183183
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
184-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
184+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
185185
.setOp(operation).setValue(AmendmentValue.from(LOCALITY))));
186-
when(jsonPatches.getPostTown()).thenReturn(Optional.empty());
187-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
186+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.empty());
187+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
188188
.setOp(operation).setValue(AmendmentValue.from(COUNTY))));
189189

190-
assertThatThrownBy(() -> translator.map(amendmentBody))
190+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
191191
.isExactlyInstanceOf(FhirValidationException.class)
192192
.hasMessage(ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE);
193193
}
194194

195195
@Test
196196
void When_CountyMissing_Expect_ThrowsFhirValidationException() {
197197
AmendmentPatchOperation operation = AmendmentPatchOperation.REPLACE;
198-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
198+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
199199
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
200-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
200+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
201201
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
202-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
202+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
203203
.setOp(operation).setValue(AmendmentValue.from(LOCALITY))));
204-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
204+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
205205
.setOp(operation).setValue(AmendmentValue.from(POST_TOWN))));
206-
when(jsonPatches.getCounty()).thenReturn(Optional.empty());
206+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.empty());
207207

208-
assertThatThrownBy(() -> translator.map(amendmentBody))
208+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
209209
.isExactlyInstanceOf(FhirValidationException.class)
210210
.hasMessage(ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE);
211211
}
212212

213213
@Test
214214
void When_RemoveForPostTown_Expect_ThrowsPatchValidationException() {
215215
AmendmentPatchOperation operation = AmendmentPatchOperation.REMOVE;
216-
when(jsonPatches.getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
216+
when(super.getJsonPatches().getHouseName()).thenReturn(Optional.of(new AmendmentPatch()
217217
.setOp(operation).setValue(AmendmentValue.from(HOUSE_NAME))));
218-
when(jsonPatches.getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
218+
when(super.getJsonPatches().getNumberOrRoadName()).thenReturn(Optional.of(new AmendmentPatch()
219219
.setOp(operation).setValue(AmendmentValue.from(ROAD_NAME))));
220-
when(jsonPatches.getLocality()).thenReturn(Optional.of(new AmendmentPatch()
220+
when(super.getJsonPatches().getLocality()).thenReturn(Optional.of(new AmendmentPatch()
221221
.setOp(operation).setValue(AmendmentValue.from(LOCALITY))));
222-
when(jsonPatches.getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
222+
when(super.getJsonPatches().getPostTown()).thenReturn(Optional.of(new AmendmentPatch()
223223
.setOp(operation).setValue(AmendmentValue.from(POST_TOWN))));
224-
when(jsonPatches.getCounty()).thenReturn(Optional.of(new AmendmentPatch()
224+
when(super.getJsonPatches().getCounty()).thenReturn(Optional.of(new AmendmentPatch()
225225
.setOp(operation).setValue(AmendmentValue.from(COUNTY))));
226226

227-
assertThatThrownBy(() -> translator.map(amendmentBody))
227+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
228228
.isExactlyInstanceOf(PatchValidationException.class)
229229
.hasMessage("Post town ('address/0/line/3') cannot be removed");
230230
}

src/test/java/uk/nhs/digital/nhsconnect/nhais/outbound/translator/amendment/mappers/AmendmentDateOfBirthToEdifactMapperTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class AmendmentDateOfBirthToEdifactMapperTest extends AmendmentFhirToEdifactTest
3939
@ParameterizedTest
4040
@MethodSource(value = "getAddOrReplaceEnums")
4141
void When_AddingOrReplacingDateOfBirth_Expect_FieldsAreMapped(AmendmentPatchOperation operation) {
42-
when(jsonPatches.getBirthDate()).thenReturn(Optional.of(new AmendmentPatch()
42+
when(super.getJsonPatches().getBirthDate()).thenReturn(Optional.of(new AmendmentPatch()
4343
.setOp(operation).setValue(AmendmentValue.from(DATE_OF_BIRTH))));
4444

45-
var segments = translator.map(amendmentBody);
45+
var segments = translator.map(super.getAmendmentBody());
4646

4747
assertThat(segments).isPresent().get()
4848
.isEqualTo(PersonDateOfBirth.builder()
@@ -52,24 +52,24 @@ void When_AddingOrReplacingDateOfBirth_Expect_FieldsAreMapped(AmendmentPatchOper
5252

5353
@Test
5454
void When_UsingRemoveOperation_Expect_Exception() {
55-
when(jsonPatches.getBirthDate()).thenReturn(Optional.of(new AmendmentPatch()
55+
when(super.getJsonPatches().getBirthDate()).thenReturn(Optional.of(new AmendmentPatch()
5656
.setOp(AmendmentPatchOperation.REMOVE)));
5757

58-
assertThatThrownBy(() -> translator.map(amendmentBody))
58+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
5959
.isInstanceOf(PatchValidationException.class)
6060
.hasMessage("Illegal remove operation on /birthDate");
6161
}
6262

6363
@ParameterizedTest
6464
@MethodSource(value = "getAddOrReplaceEnums")
6565
void When_AddOrReplaceValuesAreEmpty_Expect_Exception(AmendmentPatchOperation operation) {
66-
when(jsonPatches.getBirthDate()).thenReturn(Optional.of(new AmendmentPatch()
66+
when(super.getJsonPatches().getBirthDate()).thenReturn(Optional.of(new AmendmentPatch()
6767
.setOp(operation)
6868
.setPath(JsonPatches.BIRTH_DATE_PATH)
6969
.setValue(AmendmentValue.from(StringUtils.EMPTY))
7070
));
7171

72-
assertThatThrownBy(() -> translator.map(amendmentBody))
72+
assertThatThrownBy(() -> translator.map(super.getAmendmentBody()))
7373
.isInstanceOf(PatchValidationException.class)
7474
.hasMessage("Invalid values for: [/birthDate]");
7575
}

0 commit comments

Comments
 (0)