|
38 | 38 |
|
39 | 39 | import com.datastax.cdm.properties.IPropertyHelper;
|
40 | 40 | import com.datastax.cdm.properties.KnownProperties;
|
41 |
| -import com.fasterxml.jackson.databind.ObjectMapper; |
42 | 41 |
|
43 | 42 | @ExtendWith(MockitoExtension.class)
|
44 | 43 | class AstraDevOpsClientTest {
|
@@ -69,42 +68,39 @@ void setUp() throws Exception {
|
69 | 68 | }
|
70 | 69 |
|
71 | 70 | @Test
|
72 |
| - void testDownloadSecureBundleWithNullToken() throws IOException { |
| 71 | + void testDownloadSecureBundleWithNullToken() throws Exception { |
73 | 72 | // Setup
|
74 | 73 | when(propertyHelper.getAsString(KnownProperties.CONNECT_ORIGIN_PASSWORD)).thenReturn(null);
|
75 | 74 |
|
76 | 75 | // Test
|
77 |
| - String result = client.downloadSecureBundle(PKFactory.Side.ORIGIN); |
| 76 | + assertThrows(Exception.class, () -> client.downloadSecureBundle(PKFactory.Side.ORIGIN)); |
78 | 77 |
|
79 | 78 | // Verify
|
80 |
| - assertNull(result); |
81 | 79 | verify(propertyHelper).getAsString(KnownProperties.CONNECT_ORIGIN_PASSWORD);
|
82 | 80 | }
|
83 | 81 |
|
84 | 82 | @Test
|
85 |
| - void testDownloadSecureBundleWithEmptyToken() throws IOException { |
| 83 | + void testDownloadSecureBundleWithEmptyToken() throws Exception { |
86 | 84 | // Setup
|
87 | 85 | when(propertyHelper.getAsString(KnownProperties.CONNECT_ORIGIN_PASSWORD)).thenReturn("");
|
88 | 86 |
|
89 | 87 | // Test
|
90 |
| - String result = client.downloadSecureBundle(PKFactory.Side.ORIGIN); |
| 88 | + assertThrows(Exception.class, () -> client.downloadSecureBundle(PKFactory.Side.ORIGIN)); |
91 | 89 |
|
92 | 90 | // Verify
|
93 |
| - assertNull(result); |
94 | 91 | verify(propertyHelper).getAsString(KnownProperties.CONNECT_ORIGIN_PASSWORD);
|
95 | 92 | }
|
96 | 93 |
|
97 | 94 | @Test
|
98 |
| - void testDownloadSecureBundleWithNullDatabaseId() throws IOException { |
| 95 | + void testDownloadSecureBundleWithNullDatabaseId() throws Exception { |
99 | 96 | // Setup
|
100 | 97 | when(propertyHelper.getAsString(KnownProperties.CONNECT_ORIGIN_PASSWORD)).thenReturn("test-token");
|
101 | 98 | when(propertyHelper.getAsString(KnownProperties.ORIGIN_ASTRA_DATABASE_ID)).thenReturn(null);
|
102 | 99 |
|
103 | 100 | // Test
|
104 |
| - String result = client.downloadSecureBundle(PKFactory.Side.ORIGIN); |
| 101 | + assertThrows(Exception.class, () -> client.downloadSecureBundle(PKFactory.Side.ORIGIN)); |
105 | 102 |
|
106 | 103 | // Verify
|
107 |
| - assertNull(result); |
108 | 104 | verify(propertyHelper).getAsString(KnownProperties.CONNECT_ORIGIN_PASSWORD);
|
109 | 105 | verify(propertyHelper).getAsString(KnownProperties.ORIGIN_ASTRA_DATABASE_ID);
|
110 | 106 | }
|
@@ -527,10 +523,7 @@ void testDownloadSecureBundleWithEmptyJsonResponse() throws Exception {
|
527 | 523 | when(propertyHelper.getAsString(KnownProperties.ORIGIN_ASTRA_SCB_REGION)).thenReturn(null);
|
528 | 524 |
|
529 | 525 | // Test
|
530 |
| - String result = client.downloadSecureBundle(PKFactory.Side.ORIGIN); |
531 |
| - |
532 |
| - // Verify |
533 |
| - assertNull(result); |
| 526 | + assertThrows(Exception.class, () -> client.downloadSecureBundle(PKFactory.Side.ORIGIN)); |
534 | 527 | }
|
535 | 528 |
|
536 | 529 | @Test
|
|
0 commit comments