Skip to content

Commit fe24287

Browse files
committed
code refactoring
1 parent 3b8b387 commit fe24287

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

service/src/main/java/uk/nhs/adaptors/gp2gp/common/configuration/CustomTrustStore.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ public class CustomTrustStore {
3131
@Autowired(required = false)
3232
private S3Client s3Client;
3333

34-
public void setS3Client(S3Client s3Client) {
35-
this.s3Client = s3Client;
36-
}
37-
3834
@SneakyThrows
3935
public void addToDefault(String trustStorePath, String trustStorePassword) {
4036
final X509TrustManager defaultTrustManager = getDefaultTrustManager();

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import software.amazon.awssdk.services.s3.model.CreateBucketRequest;
1313
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
1414
import java.io.File;
15+
import java.lang.reflect.Field;
1516
import java.net.URI;
1617
import static org.junit.jupiter.api.Assertions.assertNotNull;
1718

@@ -53,9 +54,11 @@ static void tearDown() {
5354
}
5455

5556
@Test
56-
void trustManagerLoadsSuccessfullyTest() {
57+
void trustManagerLoadsSuccessfullyTest() throws NoSuchFieldException, IllegalAccessException {
5758

58-
customTrustStore.setS3Client(s3Client);
59+
Field s3ClientField = CustomTrustStore.class.getDeclaredField("s3Client");
60+
s3ClientField.setAccessible(true);
61+
s3ClientField.set(customTrustStore, s3Client);
5962

6063
String s3Uri = "s3://" + BUCKET_NAME + "/" + TRUSTSTORE_PATH;
6164

0 commit comments

Comments
 (0)