@Test( expectedExceptions = VmNotFoundException.class, expectedExceptionsMessageRegExp = "VM nonExistingVm not found") public void testAddIsoFailed() throws Throwable { VmEntity vmEntity = new VmEntity(); vmEntity.setId("nonExistingVm"); vmDcpBackend.addIso(new IsoEntity(), vmEntity); }
@Test public void testAddIso() throws Throwable { IsoEntity isoEntity = new IsoEntity(); isoEntity.setId("iso-id"); isoEntity.setName("iso-name"); isoEntity.setSize(100L); vmDcpBackend.addIso(isoEntity, vm); VmEntity updatedVm = vmDcpBackend.findById(vmId); assertThat(updatedVm, CoreMatchers.notNullValue()); assertThat(updatedVm.getIsos().size(), is(1)); assertThat(updatedVm.getIsos().get(0), is(isoEntity)); }