EntitlementDTO extends TimestampedCandlepinDTO<EntitlementDTO> implements LinkableDTO { @JsonIgnore public boolean addCertificate(CertificateDTO certificate) { if (isNullOrIncomplete(certificate)) { throw new IllegalArgumentException("certificate is null or incomplete"); } if (this.certificates == null) { this.certificates = new HashSet<>(); } return this.certificates.add(certificate); } EntitlementDTO();  EntitlementDTO(EntitlementDTO source); @HateoasInclude String getId(); EntitlementDTO setId(String id); @JsonIgnore OwnerDTO getOwner(); @JsonProperty EntitlementDTO setOwner(OwnerDTO owner); ConsumerDTO getConsumer(); EntitlementDTO setConsumer(ConsumerDTO consumer); PoolDTO getPool(); EntitlementDTO setPool(PoolDTO pool); @HateoasInclude @Override String getHref(); Integer getQuantity(); EntitlementDTO setQuantity(Integer quantity); @JsonIgnore Boolean isDeletedFromPool(); @JsonProperty EntitlementDTO setDeletedFromPool(Boolean deletedFromPool); Set<CertificateDTO> getCertificates(); EntitlementDTO setCertificates(Set<CertificateDTO> certificates); @JsonIgnore boolean addCertificate(CertificateDTO certificate); @JsonProperty Date getStartDate(); @JsonIgnore EntitlementDTO setStartDate(Date startDate); @JsonProperty Date getEndDate(); @JsonIgnore EntitlementDTO setEndDate(Date endDate); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override EntitlementDTO clone(); @Override EntitlementDTO populate(EntitlementDTO source);  }
@Test(expected = IllegalArgumentException.class) public void testAddCertificateWithNullInput() { EntitlementDTO dto = new EntitlementDTO(); dto.addCertificate(null); }