ActivationKeyDTO extends TimestampedCandlepinDTO<ActivationKeyDTO> { @JsonIgnore public boolean addProductId(String productId) { if (productId == null || productId.isEmpty()) { throw new IllegalArgumentException("productId is null or empty"); } if (this.productIds == null) { this.productIds = new HashSet<>(); } return this.productIds.add(productId); } ActivationKeyDTO();  ActivationKeyDTO(ActivationKeyDTO source); String getId(); ActivationKeyDTO setId(String id); String getName(); ActivationKeyDTO setName(String name); String getDescription(); ActivationKeyDTO setDescription(String description); OwnerDTO getOwner(); ActivationKeyDTO setOwner(OwnerDTO owner); @JsonSerialize(using = ReleaseVersionWrapSerializer.class, nullsUsing = ReleaseVersionWrapSerializer.class) @JsonProperty("releaseVer") String getReleaseVersion(); @JsonDeserialize(using = ReleaseVersionWrapDeserializer.class) @JsonProperty("releaseVer") ActivationKeyDTO setReleaseVersion(String releaseVersion); String getServiceLevel(); ActivationKeyDTO setServiceLevel(String serviceLevel); String getUsage(); ActivationKeyDTO setUsage(String usage); String getRole(); ActivationKeyDTO setRole(String role); SetView<String> getAddOns(); ActivationKeyDTO setAddOns(Set<String> addOns); Boolean isAutoAttach(); ActivationKeyDTO setAutoAttach(Boolean autoAttach); Set<ActivationKeyPoolDTO> getPools(); ActivationKeyDTO setPools(Collection<ActivationKeyPoolDTO> pools); @JsonIgnore boolean hasPool(String poolId); @JsonIgnore boolean removePool(String poolId); @JsonIgnore boolean addPool(ActivationKeyPoolDTO poolDto); @JsonSerialize(contentUsing = ProductWrapSerializer.class) @JsonProperty("products") Set<String> getProductIds(); @JsonDeserialize(contentUsing = ProductWrapDeserializer.class) @JsonProperty("products") ActivationKeyDTO setProductIds(Collection<String> productIds); @JsonIgnore boolean removeProductId(String productId); @JsonIgnore boolean hasProductId(String productId); @JsonIgnore boolean addProductId(String productId); Set<ContentOverrideDTO> getContentOverrides(); ActivationKeyDTO setContentOverrides(
        Collection<ContentOverrideDTO> contentOverrides); @JsonIgnore boolean removeContentOverride(ContentOverrideDTO contentOverrideDto); @JsonIgnore boolean addContentOverride(ContentOverrideDTO contentOverrideDto); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override ActivationKeyDTO clone(); @Override ActivationKeyDTO populate(ActivationKeyDTO source); static final long serialVersionUID; }
@Test public void testAddProductWithAbsentProduct() { ActivationKeyDTO dto = new ActivationKeyDTO(); assertTrue(dto.addProductId("test-id-prod-5")); }
@Test public void testAddProductWithPresentProduct() { ActivationKeyDTO dto = new ActivationKeyDTO(); assertTrue(dto.addProductId("test-id-prod-6")); assertFalse(dto.addProductId("test-id-prod-6")); }
@Test(expected = IllegalArgumentException.class) public void testAddProductWithNullInput() { ActivationKeyDTO dto = new ActivationKeyDTO(); dto.addProductId(null); }
@Test(expected = IllegalArgumentException.class) public void testAddProductWithEmptyProductId() { ActivationKeyDTO dto = new ActivationKeyDTO(); assertTrue(dto.addProductId("")); }