ProductData extends CandlepinDTO implements ProductInfo { @XmlTransient public boolean hasAttribute(String key) { if (key == null) { throw new IllegalArgumentException("key is null"); } return this.attributes != null && this.attributes.containsKey(key); } ProductData();  ProductData(String id, String name);  ProductData(ProductData source);  ProductData(Product source); String getUuid(); ProductData setUuid(String uuid); String getId(); ProductData setId(String id); String getName(); ProductData setName(String name); Long getMultiplier(); ProductData setMultiplier(Long multiplier); Map<String, String> getAttributes(); @XmlTransient String getAttributeValue(String key); @XmlTransient boolean hasAttribute(String key); ProductData setAttribute(String key, String value); boolean removeAttribute(String key); ProductData setAttributes(Map<String, String> attributes); Collection<ProductContentData> getProductContent(); ProductContentData getProductContent(String contentId); boolean hasContent(String contentId); boolean addProductContent(ProductContentData contentData); boolean addProductContent(ProductContent productContent); boolean addContent(ContentData contentData, boolean enabled); boolean addContent(Content content, boolean enabled); boolean removeContent(String contentId); boolean removeContent(Content content); boolean removeContent(ContentData contentData); boolean removeProductContent(ProductContent content); boolean removeProductContent(ProductContentData contentData); ProductData setProductContent(Collection<ProductContentData> content); Collection<String> getDependentProductIds(); boolean addDependentProductId(String productId); boolean removeDependentProductId(String productId); ProductData setDependentProductIds(Collection<String> dependentProductIds); Collection<Branding> getBranding(); ProductData setBranding(Collection<Branding> branding); boolean addBranding(Branding branding); boolean removeBranding(Branding branding); String getHref(); ProductData setHref(String href); @XmlTransient Boolean isLocked(); ProductData setLocked(Boolean locked); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); ProductData populate(ProductData source); ProductData populate(Product source); static final long serialVersionUID; }
@Test public void testHasAttribute() { ProductData dto = new ProductData(); Map<String, String> input = new HashMap<>(); input.put("a1", "v1"); input.put("a2", "v2"); input.put("a3", "v3"); boolean output = dto.hasAttribute("a1"); assertFalse(output); dto.setAttributes(input); output = dto.hasAttribute("a1"); assertTrue(output); output = dto.hasAttribute("a3"); assertTrue(output); output = dto.hasAttribute("a4"); assertFalse(output); }