ProductSkuSearchResultDTOImpl implements ProductSkuSearchResultDTO { @Override public ProductSkuSearchResultDTOImpl copy() { final ProductSkuSearchResultDTOImpl copy = new ProductSkuSearchResultDTOImpl(); copy.setId(this.id); copy.setProductId(this.productId); copy.setCode(this.code); copy.setManufacturerCode(this.manufacturerCode); copy.setFulfilmentCentreCode(this.fulfilmentCentreCode); copy.setName(this.name); if (this.displayName != null) { copy.setDisplayName(this.displayName.copy()); } copy.setDescription(this.description); if (this.displayDescription != null) { copy.setDisplayDescription(this.displayDescription.copy()); } copy.setDefaultImage(this.defaultImage); copy.setCreatedTimestamp(this.createdTimestamp); copy.setUpdatedTimestamp(this.updatedTimestamp); copy.setAvailablefrom(this.availablefrom); copy.setAvailableto(this.availableto); copy.setReleaseDate(this.releaseDate); copy.setRestockDate(this.restockDate); if (this.restockNotes != null) { copy.setRestockNotes(this.restockNotes.copy()); } copy.setAvailability(this.availability); if (this.qtyOnWarehouse != null) { copy.setQtyOnWarehouse(new HashMap<>(this.qtyOnWarehouse)); } copy.setFeatured(this.featured); copy.setMinOrderQuantity(this.minOrderQuantity); copy.setMaxOrderQuantity(this.maxOrderQuantity); copy.setStepOrderQuantity(this.stepOrderQuantity); copy.setTag(this.tag); if (this.attributes != null) { copy.setAttributes(new StoredAttributesDTOImpl(this.attributes.toString())); } return copy; }  @Override String getDefaultImage(); void setDefaultImage(final String defaultImage); @Override long getId(); void setId(final long id); @Override long getProductId(); void setProductId(final long productId); @Override String getCode(); void setCode(final String code); @Override String getManufacturerCode(); void setManufacturerCode(final String manufacturerCode); @Override String getFulfilmentCentreCode(); void setFulfilmentCentreCode(final String fulfilmentCentreCode); @Override StringI18NModel getDisplayName(); void setDisplayName(final StringI18NModel displayName); @Override String getName(final String locale); @Override String getName(); void setName(final String name); @Override String getDescription(); void setDescription(final String description); @Override String getDescription(final String locale); @Override StringI18NModel getDisplayDescription(); void setDisplayDescription(final StringI18NModel displayDescription); @Override BigDecimal getQtyOnWarehouse(final long shopId); Map<Long, BigDecimal> getQtyOnWarehouse(); void setQtyOnWarehouse(final Map<Long, BigDecimal> qtyOnWarehouse); @Override LocalDateTime getAvailableto(); void setAvailableto(final LocalDateTime availableto); @Override LocalDateTime getAvailablefrom(); void setAvailablefrom(final LocalDateTime availablefrom); @Override LocalDateTime getReleaseDate(); void setReleaseDate(final LocalDateTime releaseDate); @Override int getAvailability(); void setAvailability(final int availability); @Override LocalDateTime getRestockDate(); void setRestockDate(final LocalDateTime restockDate); StringI18NModel getRestockNotes(); void setRestockNotes(final StringI18NModel restockNotes); @Override String getRestockNote(final String locale); @Override boolean isFeatured(); void setFeatured(final boolean featured); @Override String getTag(); void setTag(final String tag); @Override BigDecimal getMinOrderQuantity(); void setMinOrderQuantity(final BigDecimal minOrderQuantity); @Override BigDecimal getMaxOrderQuantity(); void setMaxOrderQuantity(final BigDecimal maxOrderQuantity); @Override BigDecimal getStepOrderQuantity(); void setStepOrderQuantity(final BigDecimal stepOrderQuantity); @Override StoredAttributesDTO getAttributes(); void setAttributes(final StoredAttributesDTO attributes); @Override Instant getCreatedTimestamp(); void setCreatedTimestamp(final Instant createdTimestamp); @Override Instant getUpdatedTimestamp(); void setUpdatedTimestamp(final Instant updatedTimestamp); @Override ProductSkuSearchResultDTOImpl copy(); @Override String toString();  }
@Test public void testCopy() throws Exception { final ProductSkuSearchResultDTOImpl first = new ProductSkuSearchResultDTOImpl(); first.setId(1); first.setCode("First"); first.setManufacturerCode("ManFirst"); first.setFulfilmentCentreCode("Main"); first.setName("FirstName"); first.setDisplayName(new StringI18NModel("EN#~#FirstDisplayName")); first.setDefaultImage("FirstDefaultImage"); first.setAvailablefrom(LocalDateTime.now()); first.setAvailableto(LocalDateTime.now()); first.setReleaseDate(LocalDateTime.now()); first.setRestockDate(LocalDateTime.now()); first.setRestockNotes(new StringI18NModel("EN#~#Some text")); first.setCreatedTimestamp(Instant.now()); first.setUpdatedTimestamp(Instant.now()); first.setAvailability(1); first.setMinOrderQuantity(BigDecimal.ONE); first.setMaxOrderQuantity(BigDecimal.TEN); first.setStepOrderQuantity(BigDecimal.ONE); first.setQtyOnWarehouse(new HashMap<Long, BigDecimal>() {{ put(10L, BigDecimal.ONE); }}); first.setFeatured(true); first.setDefaultImage("FirstDefaultImageSKU.jpg"); first.setTag("tag1 tag2"); final ProductSkuSearchResultDTO copy = first.copy(); assertEquals(first.getId(), copy.getId()); assertEquals(first.getCode(), copy.getCode()); assertEquals(first.getManufacturerCode(), copy.getManufacturerCode()); assertEquals(first.getFulfilmentCentreCode(), copy.getFulfilmentCentreCode()); assertEquals(first.getName(), copy.getName()); assertEquals(first.getDisplayName(), copy.getDisplayName()); assertEquals(first.getDefaultImage(), copy.getDefaultImage()); assertEquals(first.getDisplayName(), copy.getDisplayName()); assertEquals(first.getDescription(), copy.getDescription()); assertEquals(first.getDisplayDescription(), copy.getDisplayDescription()); assertEquals(first.getAvailablefrom(), copy.getAvailablefrom()); assertEquals(first.getAvailableto(), copy.getAvailableto()); assertEquals(first.getReleaseDate(), copy.getReleaseDate()); assertEquals(first.getRestockDate(), copy.getRestockDate()); assertEquals("Some text", first.getRestockNote("EN")); assertEquals(first.getRestockNote("EN"), copy.getRestockNote("EN")); assertEquals(first.getCreatedTimestamp(), copy.getCreatedTimestamp()); assertEquals(first.getUpdatedTimestamp(), copy.getUpdatedTimestamp()); assertEquals(first.getAvailability(), copy.getAvailability()); assertEquals(first.getMinOrderQuantity(), copy.getMinOrderQuantity()); assertEquals(first.getMaxOrderQuantity(), copy.getMaxOrderQuantity()); assertEquals(first.getStepOrderQuantity(), copy.getStepOrderQuantity()); assertNotNull(first.getQtyOnWarehouse(10L)); assertEquals(BigDecimal.ONE, first.getQtyOnWarehouse(10L)); assertEquals(BigDecimal.ONE, copy.getQtyOnWarehouse(10L)); assertEquals(first.getDefaultImage(), copy.getDefaultImage()); assertEquals(first.isFeatured(), copy.isFeatured()); assertEquals(first.getTag(), copy.getTag()); assertFalse(first.equals(copy)); assertFalse(first.hashCode() == copy.hashCode()); }