PoolDTO extends TimestampedCandlepinDTO<PoolDTO> { @JsonIgnore public boolean hasProductAttribute(String key) { if (key == null) { throw new IllegalArgumentException("key is null"); } if (this.productAttributes == null) { return false; } return this.productAttributes.containsKey(key); } PoolDTO();  PoolDTO(PoolDTO source); @HateoasInclude String getId(); PoolDTO setId(String id); @JsonProperty String getType(); @JsonIgnore PoolDTO setType(String type); OwnerDTO getOwner(); PoolDTO setOwner(OwnerDTO owner); Boolean isActiveSubscription(); PoolDTO setActiveSubscription(Boolean activeSubscription); EntitlementDTO getSourceEntitlement(); PoolDTO setSourceEntitlement(EntitlementDTO sourceEntitlement); Long getQuantity(); PoolDTO setQuantity(Long quantity); @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); String getContractNumber(); PoolDTO setContractNumber(String contractNumber); String getAccountNumber(); PoolDTO setAccountNumber(String accountNumber); String getOrderNumber(); PoolDTO setOrderNumber(String orderNumber); Set<BrandingDTO> getBranding(); PoolDTO setBranding(Set<BrandingDTO> branding); @JsonIgnore boolean addBranding(BrandingDTO branding); Long getConsumed(); PoolDTO setConsumed(Long consumed); Long getExported(); PoolDTO setExported(Long exported); Map<String, String> getCalculatedAttributes(); PoolDTO setCalculatedAttributes(Map<String, String> calculatedAttributes); String getUpstreamPoolId(); PoolDTO setUpstreamPoolId(String upstreamPoolId); String getUpstreamEntitlementId(); PoolDTO setUpstreamEntitlementId(String upstreamEntitlementId); String getUpstreamConsumerId(); PoolDTO setUpstreamConsumerId(String upstreamConsumerId); @JsonProperty @HateoasInclude String getProductName(); @JsonIgnore PoolDTO setProductName(String productName); @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); @JsonProperty String getStackId(); @JsonIgnore PoolDTO setStackId(String stackId); @JsonProperty Boolean isStacked(); @JsonIgnore PoolDTO setStacked(Boolean stacked); @JsonProperty String getSourceStackId(); @JsonIgnore PoolDTO setSourceStackId(String sourceStackId); @JsonProperty Boolean isDevelopmentPool(); @JsonIgnore PoolDTO setDevelopmentPool(Boolean developmentPool); @JsonSerialize(using = CandlepinLegacyAttributeSerializer.class) Map<String, String> getDerivedProductAttributes(); @JsonDeserialize(using = CandlepinAttributeDeserializer.class) PoolDTO setDerivedProductAttributes(Map<String, String> derivedProductAttributes); String getDerivedProductId(); PoolDTO setDerivedProductId(String derivedProductId); @JsonProperty String getDerivedProductName(); @JsonIgnore PoolDTO setDerivedProductName(String derivedProductName); 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); String getSubscriptionSubKey(); PoolDTO setSubscriptionSubKey(String subscriptionSubKey); String getSubscriptionId(); PoolDTO setSubscriptionId(String subscriptionId); Date getStartDate(); PoolDTO setStartDate(Date startDate); Date getEndDate(); PoolDTO setEndDate(Date endDate); @JsonIgnore CertificateDTO getCertificate(); @JsonProperty PoolDTO setCertificate(CertificateDTO certificate); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override PoolDTO clone(); @Override PoolDTO populate(PoolDTO source); static final long serialVersionUID; }
@Test public void testHasProductAttributeWithAbsentProductAttribute() { PoolDTO dto = new PoolDTO(); assertFalse(dto.hasProductAttribute("prod-attribute-key-1")); }
@Test(expected = IllegalArgumentException.class) public void testHasProductAttributeWithNullInput() { PoolDTO dto = new PoolDTO(); dto.hasProductAttribute(null); }