### Question:
RelatedItemSearch { public RelatedItemSearch copy(Configuration config) { RelatedItemSearch newCopy = new RelatedItemSearch(config,this.getAdditionalSearchCriteria().getNumberOfProperties()); newCopy.setRelatedItemId(this.relatedItemId); newCopy.setMaxResults(this.maxResults); newCopy.setRelatedItemSearchType(this.searchType); newCopy.setLookupKey(this.getLookupKey()); newCopy.setStartOfRequestNanos(this.getStartOfRequestNanos()); this.additionalSearchCriteria.copyTo(newCopy.additionalSearchCriteria); return newCopy; } RelatedItemSearch(Configuration config);  RelatedItemSearch(Configuration config,int numberOfAdditionalSearchCriteria); void setMaxResults(int maxResults); int getMaxResults(); RelatedItemAdditionalProperties getAdditionalSearchCriteria(); void setRelatedItemId(String id); String getRelatedItemId(); RelatedItemInfoIdentifier getRelatedContentIdentifier(); RelatedItemSearchType getRelatedItemSearchType(); void setRelatedItemSearchType(RelatedItemSearchType searchType); RelatedItemSearch copy(Configuration config); void setLookupKey(SearchRequestLookupKey key); SearchRequestLookupKey getLookupKey(); long getStartOfRequestNanos(); void setStartOfRequestNanos(long startOfRequestNanos); static final String RESULTS_SET_SIZE_KEY; static final String ID_KEY; static final int RESULTS_SET_SIZE_KEY_LENGTH; static final int ID_KEY_LENGTH; }### Answer:
@Test public void testCopy() { Configuration c = new SystemPropertiesConfiguration(); RelatedItemSearch searchObject = new RelatedItemSearch(new SystemPropertiesConfiguration()); searchObject.getAdditionalSearchCriteria().addProperty("key","value"); searchObject.getAdditionalSearchCriteria().addProperty("request","response"); searchObject.setRelatedItemId("I am a unique identifier"); searchObject.setMaxResults(1); searchObject.setRelatedItemSearchType(RelatedItemSearchType.FREQUENTLY_RELATED_WITH); RelatedItemSearchLookupKeyGenerator factory = new KeyFactoryBasedRelatedItemSearchLookupKeyGenerator(c,new SipHashSearchRequestLookupKeyFactory()); factory.setSearchRequestLookupKeyOn(searchObject); RelatedItemSearch copy = searchObject.copy(c); assertNotSame(copy,searchObject); assertEquals(copy.getMaxResults(),searchObject.getMaxResults()); assertEquals(copy.getRelatedItemId(),searchObject.getRelatedItemId()); assertEquals(copy.getRelatedItemSearchType(),searchObject.getRelatedItemSearchType()); assertEquals(copy.getLookupKey(),searchObject.getLookupKey()); assertEquals(copy.getAdditionalSearchCriteria().getNumberOfProperties(),searchObject.getAdditionalSearchCriteria().getNumberOfProperties()); assertEquals(copy.getAdditionalSearchCriteria().getPropertyName(0),searchObject.getAdditionalSearchCriteria().getPropertyName(0)); assertEquals(copy.getAdditionalSearchCriteria().getPropertyName(1),searchObject.getAdditionalSearchCriteria().getPropertyName(1)); assertEquals(copy.getAdditionalSearchCriteria().getPropertyValue(0),searchObject.getAdditionalSearchCriteria().getPropertyValue(0)); assertEquals(copy.getAdditionalSearchCriteria().getPropertyValue(1),searchObject.getAdditionalSearchCriteria().getPropertyValue(1)); assertNotSame(copy.getRelatedContentIdentifier(),searchObject.getRelatedContentIdentifier()); assertEquals(copy.getRelatedContentIdentifier().toString(),searchObject.getRelatedContentIdentifier().toString()); }