ConsumerDTO extends TimestampedCandlepinDTO<ConsumerDTO> implements LinkableDTO { public boolean addGuestId(GuestIdDTO guestId) { if (guestId == null || StringUtils.isEmpty(guestId.getGuestId())) { throw new IllegalArgumentException("guestId is null"); } if (guestIds == null) { guestIds = new ArrayList<>(); } boolean exists = false; for (GuestIdDTO guestIdDTO : guestIds) { if (guestIdDTO.getGuestId().contentEquals(guestId.getGuestId())) { exists = true; } } if (!exists) { return this.guestIds.add(guestId); } return false; } ConsumerDTO();  ConsumerDTO(ConsumerDTO source); @HateoasInclude String getId(); ConsumerDTO setId(String id); @HateoasInclude String getUuid(); ConsumerDTO setUuid(String uuid); @HateoasInclude String getName(); ConsumerDTO setName(String name); String getUsername(); ConsumerDTO setUsername(String username); String getEntitlementStatus(); ConsumerDTO setEntitlementStatus(String entitlementStatus); String getServiceLevel(); ConsumerDTO setServiceLevel(String serviceLevel); String getRole(); ConsumerDTO setRole(String role); String getUsage(); ConsumerDTO setUsage(String usage); String getSystemPurposeStatus(); ConsumerDTO setSystemPurposeStatus(String systemPurposeStatus); Set<String> getAddOns(); ConsumerDTO setAddOns(Set<String> addOns); @JsonSerialize(using = ConsumerDTO.ReleaseVersionWrapSerializer.class, nullsUsing = ConsumerDTO.ReleaseVersionWrapSerializer.class) @JsonProperty("releaseVer") String getReleaseVersion(); @JsonDeserialize(using = ConsumerDTO.ReleaseVersionWrapDeserializer.class) @JsonProperty("releaseVer") ConsumerDTO setReleaseVersion(String releaseVer); OwnerDTO getOwner(); ConsumerDTO setOwner(OwnerDTO owner); EnvironmentDTO getEnvironment(); ConsumerDTO setEnvironment(EnvironmentDTO environment); Long getEntitlementCount(); ConsumerDTO setEntitlementCount(Long entitlementCount); @HateoasArrayExclude Map<String, String> getFacts(); ConsumerDTO setFacts(Map<String, String> facts); ConsumerDTO setFact(String key, String value); Date getLastCheckin(); ConsumerDTO setLastCheckin(Date lastCheckin); Set<ConsumerInstalledProductDTO> getInstalledProducts(); ConsumerDTO setInstalledProducts(Set<ConsumerInstalledProductDTO> installedProducts); boolean addInstalledProduct(ConsumerInstalledProductDTO installedProduct); boolean removeInstalledProduct(String productId); Boolean isCanActivate(); ConsumerDTO setCanActivate(Boolean canActivate); Set<CapabilityDTO> getCapabilities(); ConsumerDTO setCapabilities(Set<CapabilityDTO> capabilities); HypervisorIdDTO getHypervisorId(); ConsumerDTO setHypervisorId(HypervisorIdDTO hypervisorId); Set<String> getContentTags(); ConsumerDTO setContentTags(Set<String> contentTags); Boolean getAutoheal(); ConsumerDTO setAutoheal(Boolean autoheal); String getAnnotations(); ConsumerDTO setAnnotations(String annotations); String getContentAccessMode(); ConsumerDTO setContentAccessMode(String contentAccessMode); ConsumerTypeDTO getType(); ConsumerDTO setType(ConsumerTypeDTO type); @HateoasArrayExclude @JsonProperty("idCert") CertificateDTO getIdCertificate(); @JsonProperty("idCert") ConsumerDTO setIdCertificate(CertificateDTO idCert); List<GuestIdDTO> getGuestIds(); @JsonProperty ConsumerDTO setGuestIds(List<GuestIdDTO> guestIds); boolean addGuestId(GuestIdDTO guestId); boolean removeGuestId(String guestId); @JsonIgnore boolean isGuest(); String getFact(String factKey); @Override @HateoasInclude String getHref(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override ConsumerDTO clone(); @Override ConsumerDTO populate(ConsumerDTO source); static final long serialVersionUID; }
@Test(expected = IllegalArgumentException.class) public void testAddNullToGuestIds() throws Exception { ConsumerDTO dto = new ConsumerDTO(); dto.addGuestId(null); }