Skip to content

Commit 776b9a2

Browse files
CSTACKEX-18_2: junit fix2
1 parent 49df4c3 commit 776b9a2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/vmsnapshot/OntapVMSnapshotStrategyTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,12 @@ void testCanHandle_AllocatedDiskType_AllVolumesOnOntap_ReturnsHighest() {
219219
}
220220

221221
@Test
222-
void testCanHandle_AllocatedDiskAndMemoryType_ReturnsCantHandle() {
222+
void testCanHandle_AllocatedDiskAndMemoryType_ThrowsException() {
223223
VMSnapshotVO vmSnapshot = createMockVmSnapshot(VMSnapshot.State.Allocated, VMSnapshot.Type.DiskAndMemory);
224224
when(vmSnapshot.getVmId()).thenReturn(VM_ID);
225-
try{
226-
strategy.canHandle(vmSnapshot);
227-
} catch (CloudRuntimeException ex) {
228-
assertEquals(true, ex.getMessage().contains("Memory snapshots are not supported"));
229-
}
225+
226+
CloudRuntimeException ex = assertThrows(CloudRuntimeException.class, () -> strategy.canHandle(vmSnapshot));
227+
assertEquals(true, ex.getMessage().contains("Memory snapshots are not supported") || ex.getMessage().contains("cannot handle memory snapshots"));
230228
}
231229

232230
@Test

0 commit comments

Comments
 (0)