HypervisorUpdateResultDTO extends CandlepinDTO<HypervisorUpdateResultDTO> { public boolean addCreated(HypervisorConsumerDTO hypervisorConsumerDTO) { if (isNullOrIncomplete(hypervisorConsumerDTO)) { throw new IllegalArgumentException("consumer is null or incomplete"); } if (this.created == null) { this.created = new HashSet<>(); } return this.created.add(hypervisorConsumerDTO); } HypervisorUpdateResultDTO();  HypervisorUpdateResultDTO(HypervisorUpdateResultDTO source); boolean wasCreated(HypervisorConsumerDTO hypervisorConsumerDTO); boolean addCreated(HypervisorConsumerDTO hypervisorConsumerDTO); boolean addUpdated(HypervisorConsumerDTO hypervisorConsumerDTO); boolean addUnchanged(HypervisorConsumerDTO hypervisorConsumerDTO); boolean addFailed(String hostVirtId, String errorMessage); @JsonSerialize(nullsUsing = NullToEmptySetSerializer.class) Collection<HypervisorConsumerDTO> getCreated(); HypervisorUpdateResultDTO setCreated(Collection<HypervisorConsumerDTO> created); @JsonSerialize(nullsUsing = NullToEmptySetSerializer.class) Collection<HypervisorConsumerDTO> getUpdated(); HypervisorUpdateResultDTO setUpdated(Collection<HypervisorConsumerDTO> updated); @JsonSerialize(nullsUsing = NullToEmptySetSerializer.class) Collection<HypervisorConsumerDTO> getUnchanged(); HypervisorUpdateResultDTO setUnchanged(Collection<HypervisorConsumerDTO> unchanged); @JsonSerialize(nullsUsing = NullToEmptySetSerializer.class) Collection<String> getFailedUpdate(); HypervisorUpdateResultDTO setFailedUpdate(Collection<String> failedUpdate); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override HypervisorUpdateResultDTO clone(); @Override HypervisorUpdateResultDTO populate(HypervisorUpdateResultDTO source);  }
@Test public void testAddCreatedWithAbsentCreated() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid("test-created-uuid-id-1"); created.setName("test-created-name-1"); HypervisorConsumerDTO.OwnerDTO owner = new HypervisorConsumerDTO.OwnerDTO(); owner.setKey("test-key-1"); created.setOwner(owner); assertTrue(dto.addCreated(created)); }
@Test public void testAddCreatedWithPresentCreated() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid("test-created-uuid-id-2"); created.setName("test-created-name-2"); HypervisorConsumerDTO.OwnerDTO owner = new HypervisorConsumerDTO.OwnerDTO(); owner.setKey("test-key-2"); created.setOwner(owner); assertTrue(dto.addCreated(created)); HypervisorConsumerDTO created2 = new HypervisorConsumerDTO(); created2.setUuid("test-created-uuid-id-2"); created2.setName("test-created-name-2"); HypervisorConsumerDTO.OwnerDTO owner2 = new HypervisorConsumerDTO.OwnerDTO(); owner2.setKey("test-key-2"); created2.setOwner(owner2); assertFalse(dto.addCreated(created2)); }
@Test(expected = IllegalArgumentException.class) public void testAddCreatedWithNullInput() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); dto.addCreated(null); }
@Test(expected = IllegalArgumentException.class) public void testAddCreatedWithEmptyUuid() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid(""); created.setName("test-created-name-3"); HypervisorConsumerDTO.OwnerDTO owner3 = new HypervisorConsumerDTO.OwnerDTO(); owner3.setKey("test-key-3"); created.setOwner(owner3); dto.addCreated(created); }
@Test(expected = IllegalArgumentException.class) public void testAddCreatedWithEmptyName() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid("test-created-uuid-id-4"); created.setName(""); HypervisorConsumerDTO.OwnerDTO owner4 = new HypervisorConsumerDTO.OwnerDTO(); owner4.setKey("test-key-4"); created.setOwner(owner4); dto.addCreated(created); }
@Test(expected = IllegalArgumentException.class) public void testAddCreatedWithNullOwner() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid("test-created-uuid-id-5"); created.setName("test-created-name-5"); created.setOwner(null); dto.addCreated(created); }
@Test(expected = IllegalArgumentException.class) public void testAddCreatedWithNullOwnerKey() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid("test-created-uuid-id-5"); created.setName("test-created-name-5"); created.setOwner(new HypervisorConsumerDTO.OwnerDTO()); dto.addCreated(created); }
@Test(expected = IllegalArgumentException.class) public void testAddCreatedWithEmptyOwnerKey() { HypervisorUpdateResultDTO dto = new HypervisorUpdateResultDTO(); HypervisorConsumerDTO created = new HypervisorConsumerDTO(); created.setUuid("test-created-uuid-id-5"); created.setName("test-created-name-5"); HypervisorConsumerDTO.OwnerDTO owner = new HypervisorConsumerDTO.OwnerDTO(); owner.setKey(""); created.setOwner(owner); dto.addCreated(created); }