SolutionCloner<TestdataEntityCollectionPropertySolution> cloner = createSolutionCloner(solutionDescriptor);
TestdataValue val1 = new TestdataValue("1");
TestdataValue val2 = new TestdataValue("2");
TestdataValue val3 = new TestdataValue("3");
TestdataEntityCollectionPropertyEntity a = new TestdataEntityCollectionPropertyEntity("a", val1);
TestdataEntityCollectionPropertyEntity b = new TestdataEntityCollectionPropertyEntity("b", val1);
TestdataEntityCollectionPropertyEntity c = new TestdataEntityCollectionPropertyEntity("c", val3);
a.setEntityList(Arrays.asList(b, c));
a.setEntitySet(new HashSet<TestdataEntityCollectionPropertyEntity>(Arrays.asList(b, c)));
a.setStringToEntityMap(new HashMap<String, TestdataEntityCollectionPropertyEntity>());
a.getStringToEntityMap().put("b", b);
a.getStringToEntityMap().put("c", c);
a.setEntityToStringMap(new HashMap<TestdataEntityCollectionPropertyEntity, String>());
a.getEntityToStringMap().put(b, "b");
a.getEntityToStringMap().put(c, "c");
a.setStringToEntityListMap(new HashMap<String, List<TestdataEntityCollectionPropertyEntity>>());
a.getStringToEntityListMap().put("bc", Arrays.asList(b, c));
b.setEntityList(Collections.<TestdataEntityCollectionPropertyEntity>emptyList());
b.setEntitySet(new HashSet<TestdataEntityCollectionPropertyEntity>());
b.setStringToEntityMap(new HashMap<String, TestdataEntityCollectionPropertyEntity>());
b.setEntityToStringMap(null);
b.setStringToEntityListMap(null);
c.setEntityList(Arrays.asList(a, c));
c.setEntitySet(new HashSet<TestdataEntityCollectionPropertyEntity>(Arrays.asList(a, c)));
c.setStringToEntityMap(new HashMap<String, TestdataEntityCollectionPropertyEntity>());
c.getStringToEntityMap().put("a", a);
c.getStringToEntityMap().put("c", c);
c.setEntityToStringMap(null);
c.setStringToEntityListMap(null);
TestdataEntityCollectionPropertySolution original = new TestdataEntityCollectionPropertySolution("solution");
List<TestdataValue> valueList = Arrays.asList(val1, val2, val3);
original.setValueList(valueList);
List<TestdataEntityCollectionPropertyEntity> originalEntityList = Arrays.asList(a, b, c);
original.setEntityList(originalEntityList);
TestdataEntityCollectionPropertySolution clone = cloner.cloneSolution(original);
assertNotSame(original, clone);
assertCode("solution", clone);
assertSame(valueList, clone.getValueList());
List<TestdataEntityCollectionPropertyEntity> cloneEntityList = clone.getEntityList();
assertNotSame(originalEntityList, cloneEntityList);
assertEquals(3, cloneEntityList.size());
TestdataEntityCollectionPropertyEntity cloneA = cloneEntityList.get(0);
TestdataEntityCollectionPropertyEntity cloneB = cloneEntityList.get(1);
TestdataEntityCollectionPropertyEntity cloneC = cloneEntityList.get(2);
assertEntityCollectionPropertyEntityClone(a, cloneA, "a", "1");
assertNotSame(a.getEntityList(), cloneA.getEntityList());
assertEquals(2, cloneA.getEntityList().size());
assertSame(cloneB, cloneA.getEntityList().get(0));
assertSame(cloneC, cloneA.getEntityList().get(1));
assertNotSame(a.getEntitySet(), cloneA.getEntitySet());
assertEquals(2, cloneA.getEntitySet().size());
assertNotSame(a.getStringToEntityMap(), cloneA.getStringToEntityMap());
assertEquals(2, cloneA.getStringToEntityMap().size());
assertSame(cloneB, cloneA.getStringToEntityMap().get("b"));
assertSame(cloneC, cloneA.getStringToEntityMap().get("c"));
assertNotSame(a.getEntityToStringMap(), cloneA.getEntityToStringMap());
assertEquals(2, cloneA.getEntityToStringMap().size());
assertEquals("b", cloneA.getEntityToStringMap().get(cloneB));
assertEquals("c", cloneA.getEntityToStringMap().get(cloneC));
assertNotSame(a.getStringToEntityListMap(), cloneA.getStringToEntityListMap());
assertEquals(1, cloneA.getStringToEntityListMap().size());
List<TestdataEntityCollectionPropertyEntity> entityListOfMap = cloneA.getStringToEntityListMap().get("bc");
assertEquals(2, entityListOfMap.size());
assertSame(cloneB, entityListOfMap.get(0));
assertSame(cloneC, entityListOfMap.get(1));
assertEntityCollectionPropertyEntityClone(b, cloneB, "b", "1");
assertEquals(0, cloneB.getEntityList().size());
assertEquals(0, cloneB.getEntitySet().size());
assertEquals(0, cloneB.getStringToEntityMap().size());
assertNull(cloneB.getEntityToStringMap());
assertNull(cloneB.getStringToEntityListMap());
assertEntityCollectionPropertyEntityClone(c, cloneC, "c", "3");
assertEquals(2, cloneC.getEntityList().size());
assertSame(cloneA, cloneC.getEntityList().get(0));
assertSame(cloneC, cloneC.getEntityList().get(1));
assertEquals(2, cloneC.getEntitySet().size());
assertEquals(2, cloneC.getStringToEntityMap().size());
assertSame(cloneA, cloneC.getStringToEntityMap().get("a"));
assertSame(cloneC, cloneC.getStringToEntityMap().get("c"));
assertNull(cloneC.getEntityToStringMap());
assertNull(cloneC.getStringToEntityListMap());
}