Source:
public void testAddFromScratch() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpHttpHeaderExpectations("Expect", "201-created"); setUriInfo(setUpBasicUriExpectations()); setUpGetPayloadExpectations(2, 0); setUpGetBallooningExpectations(2, 0); setUpGetCertuficateExpectations(2, 0); setUpEntityQueryExpectations(VdcQueryType.GetVmByVmId, GetVmByVmIdParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0)); setUpEntityQueryExpectations(VdcQueryType.GetVdsGroupByVdsGroupId, GetVdsGroupByVdsGroupIdParameters.class, new String[] { "VdsGroupId" }, new Object[] { GUIDS[1] }, getVdsGroupEntity()); setUpEntityQueryExpectations(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getTemplateEntity(0)); Disks disks = new Disks(); disks.getDisks().add(new Disk()); setUpCreationExpectations(VdcActionType.AddVmFromScratch, AddVmFromScratchParameters.class, new String[] { "StorageDomainId", "DiskInfoList" }, new Object[] { Guid.Empty, mapDisks(disks) }, true, true, GUIDS[0], asList(GUIDS[1]), asList(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)), VdcQueryType.GetVmByVmId, GetVmByVmIdParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0)); VM model = getModel(0); model.setCluster(new Cluster()); model.getCluster().setId(GUIDS[1].toString()); model.setTemplate(new Template()); model.getTemplate().setId(DEFAULT_TEMPLATE_ID); model.setDisks(disks); Response response = collection.add(model); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); verifyModel((VM) response.getEntity(), 0); assertNull(((VM)response.getEntity()).getCreationStatus()); }

Target:
public void testAddFromScratch() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpHttpHeaderExpectations("Expect", "201-created"); setUpGetPayloadExpectations(2, 0); setUpGetBallooningExpectations(2, 0); setUpGetCertuficateExpectations(2, 0); setUpEntityQueryExpectations(VdcQueryType.GetVmByVmId, GetVmByVmIdParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0)); setUpEntityQueryExpectations(VdcQueryType.GetVdsGroupByVdsGroupId, GetVdsGroupByVdsGroupIdParameters.class, new String[] { "VdsGroupId" }, new Object[] { GUIDS[1] }, getVdsGroupEntity()); setUpEntityQueryExpectations(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getTemplateEntity(0)); Disks disks = new Disks(); disks.getDisks().add(new Disk()); setUpCreationExpectations(VdcActionType.AddVmFromScratch, AddVmFromScratchParameters.class, new String[] { "StorageDomainId", "DiskInfoList" }, new Object[] { Guid.Empty, mapDisks(disks) }, true, true, GUIDS[0], asList(GUIDS[1]), asList(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)), VdcQueryType.GetVmByVmId, GetVmByVmIdParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0)); VM model = getModel(0); model.setCluster(new Cluster()); model.getCluster().setId(GUIDS[1].toString()); model.setTemplate(new Template()); model.getTemplate().setId(DEFAULT_TEMPLATE_ID); model.setDisks(disks); Response response = collection.add(model); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); verifyModel((VM) response.getEntity(), 0); assertNull(((VM)response.getEntity()).getCreationStatus()); }