@@ -239,11 +239,9 @@ public void testConnect_svmNotFound() {
239239
240240 when (svmFeignClient .getSvmResponse (anyMap (), anyString ())).thenReturn (svmResponse );
241241
242- // Execute
243- boolean result = storageStrategy .connect ();
244-
245- // Verify
246- assertFalse (result , "connect() should return false when SVM is not found" );
242+ // Execute & Verify
243+ CloudRuntimeException ex = assertThrows (CloudRuntimeException .class , () -> storageStrategy .connect ());
244+ assertTrue (ex .getMessage ().contains ("No SVM found" ));
247245 }
248246
249247 @ Test
@@ -259,11 +257,9 @@ public void testConnect_svmNotRunning() {
259257
260258 when (svmFeignClient .getSvmResponse (anyMap (), anyString ())).thenReturn (svmResponse );
261259
262- // Execute
263- boolean result = storageStrategy .connect ();
264-
265- // Verify
266- assertFalse (result , "connect() should return false when SVM is not running" );
260+ // Execute & Verify
261+ CloudRuntimeException ex = assertThrows (CloudRuntimeException .class , () -> storageStrategy .connect ());
262+ assertTrue (ex .getMessage ().contains ("not in running state" ));
267263 }
268264
269265 @ Test
@@ -285,8 +281,8 @@ public void testConnect_nfsNotEnabled() {
285281 when (svmFeignClient .getSvmResponse (anyMap (), anyString ())).thenReturn (svmResponse );
286282
287283 // Execute & Verify
288- boolean result = storageStrategy .connect ();
289- assertFalse ( result , "connect() should fail when NFS is disabled" );
284+ CloudRuntimeException ex = assertThrows ( CloudRuntimeException . class , () -> storageStrategy .connect () );
285+ assertTrue ( ex . getMessage (). contains ( " NFS protocol is not enabled" ) );
290286 }
291287
292288 @ Test
@@ -314,8 +310,8 @@ public void testConnect_iscsiNotEnabled() {
314310 when (svmFeignClient .getSvmResponse (anyMap (), anyString ())).thenReturn (svmResponse );
315311
316312 // Execute & Verify
317- boolean result = storageStrategy .connect ();
318- assertFalse ( result , "connect() should fail when iSCSI is disabled" );
313+ CloudRuntimeException ex = assertThrows ( CloudRuntimeException . class , () -> storageStrategy .connect () );
314+ assertTrue ( ex . getMessage (). contains ( " iSCSI protocol is not enabled" ) );
319315 }
320316
321317 @ Test
@@ -332,23 +328,19 @@ public void testConnect_noAggregates() {
332328
333329 when (svmFeignClient .getSvmResponse (anyMap (), anyString ())).thenReturn (svmResponse );
334330
335- // Execute
336- boolean result = storageStrategy .connect ();
337-
338- // Verify
339- assertFalse (result , "connect() should return false when no aggregates are assigned" );
331+ // Execute & Verify
332+ CloudRuntimeException ex = assertThrows (CloudRuntimeException .class , () -> storageStrategy .connect ());
333+ assertTrue (ex .getMessage ().contains ("No aggregates" ));
340334 }
341335
342336 @ Test
343337 public void testConnect_nullSvmResponse () {
344338 // Setup
345339 when (svmFeignClient .getSvmResponse (anyMap (), anyString ())).thenReturn (null );
346340
347- // Execute
348- boolean result = storageStrategy .connect ();
349-
350- // Verify
351- assertFalse (result , "connect() should return false when SVM response is null" );
341+ // Execute & Verify
342+ CloudRuntimeException ex = assertThrows (CloudRuntimeException .class , () -> storageStrategy .connect ());
343+ assertTrue (ex .getMessage ().contains ("No SVM found" ));
352344 }
353345
354346 // ========== createStorageVolume() Tests ==========
0 commit comments