PoolDTO extends CandlepinDTO<PoolDTO> { @JsonIgnore public boolean removeAttribute(String key) { if (key == null) { throw new IllegalArgumentException("key is null"); } if (this.attributes == null) { return false; } boolean present = this.attributes.containsKey(key); this.attributes.remove(key); return present; } PoolDTO();  PoolDTO(PoolDTO source); @HateoasInclude String getId(); PoolDTO setId(String id); Long getQuantity(); PoolDTO setQuantity(Long quantity); Date getStartDate(); PoolDTO setStartDate(Date startDate); Date getEndDate(); PoolDTO setEndDate(Date endDate); @JsonSerialize(using = CandlepinLegacyAttributeSerializer.class) Map<String, String> getAttributes(); @JsonDeserialize(using = CandlepinAttributeDeserializer.class) PoolDTO setAttributes(Map<String, String> attributes); @JsonIgnore boolean hasAttribute(String key); @JsonIgnore boolean removeAttribute(String key); String getRestrictedToUsername(); PoolDTO setRestrictedToUsername(String restrictedToUsername); Long getConsumed(); PoolDTO setConsumed(Long consumed); @HateoasInclude String getProductId(); PoolDTO setProductId(String productId); @JsonSerialize(using = CandlepinLegacyAttributeSerializer.class) Map<String, String> getProductAttributes(); @JsonDeserialize(using = CandlepinAttributeDeserializer.class) PoolDTO setProductAttributes(Map<String, String> productAttributes); @JsonIgnore boolean hasProductAttribute(String key); String getDerivedProductId(); PoolDTO setDerivedProductId(String derivedProductId); Set<ProvidedProductDTO> getProvidedProducts(); PoolDTO setProvidedProducts(Set<ProvidedProductDTO> providedProducts); @JsonIgnore boolean addProvidedProduct(ProvidedProductDTO providedProduct); Set<ProvidedProductDTO> getDerivedProvidedProducts(); PoolDTO setDerivedProvidedProducts(Set<ProvidedProductDTO> derivedProvidedProducts); @JsonIgnore boolean addDerivedProvidedProduct(ProvidedProductDTO derivedProvidedProduct); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override PoolDTO clone(); @Override PoolDTO populate(PoolDTO source); static final long serialVersionUID; }
@Test(expected = IllegalArgumentException.class) public void testRemoveAttributeWithNullInput() { PoolDTO dto = new PoolDTO(); dto.removeAttribute(null); }