File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
service/src/test/java/uk/nhs/adaptors/gp2gp/common/configuration Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ package uk .nhs .adaptors .gp2gp .common .configuration ;
2+
3+ import org .junit .jupiter .api .BeforeEach ;
4+ import org .junit .jupiter .api .Test ;
5+ import software .amazon .awssdk .services .s3 .S3Client ;
6+ import uk .nhs .adaptors .gp2gp .common .storage .StorageConnectorConfiguration ;
7+
8+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
9+ import static org .junit .jupiter .api .Assertions .assertNull ;
10+
11+ class AppInitializerTest {
12+
13+ private AppInitializer appInitializer ;
14+ private StorageConnectorConfiguration storageConnectorConfiguration ;
15+
16+ @ BeforeEach
17+ void setUp () {
18+ storageConnectorConfiguration = new StorageConnectorConfiguration ();
19+ }
20+
21+ @ Test
22+ void getS3ClientWhenTrustStoreUrlExists () {
23+ storageConnectorConfiguration .setTrustStoreUrl ("s3://localhost" );
24+ appInitializer = new AppInitializer (storageConnectorConfiguration );
25+
26+ S3Client s3Client = appInitializer .getS3Client ();
27+
28+ assertNotNull (s3Client );
29+ }
30+
31+ @ Test
32+ void getNullWhenTrustStoreUrlDoesNotExists () {
33+
34+ storageConnectorConfiguration .setTrustStoreUrl (null );
35+ appInitializer = new AppInitializer (storageConnectorConfiguration );
36+
37+ S3Client s3Client = appInitializer .getS3Client ();
38+
39+ assertNull (s3Client );
40+ }
41+
42+ @ Test
43+ void getNullWhenTrustStoreUrlDoesNotStartWithS3Prefix () {
44+
45+ storageConnectorConfiguration .setTrustStoreUrl ("http://localhost" );
46+ appInitializer = new AppInitializer (storageConnectorConfiguration );
47+
48+ S3Client s3Client = appInitializer .getS3Client ();
49+
50+ assertNull (s3Client );
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments