@Test
public void testRemoveOrphans() {
mapper = getMapper(new String[] { "removeOrphansMapping.xml" });
MyClassA myClassA = new MyClassA();
MyClassB myClassB = new MyClassB();
Fruit apple = new Fruit();
apple.setName("Apple");
Fruit banana = new Fruit();
banana.setName("Banana");
Fruit grape = new Fruit();
grape.setName("Grape");
Fruit orange = new Fruit();
orange.setName("Orange");
Fruit kiwiFruit = new Fruit();
kiwiFruit.setName("Kiwi Fruit");
List<Fruit> srcFruits = new ArrayList<Fruit>();
srcFruits.add(apple);
srcFruits.add(banana);
srcFruits.add(kiwiFruit);
List<Fruit> destFruits = new ArrayList<Fruit>();
destFruits.add(grape); // not in src
destFruits.add(banana); // shared with src fruits
destFruits.add(orange); // not in src
myClassA.setAStringList(srcFruits);
myClassB.setAStringList(destFruits);
mapper.map(myClassA, myClassB, "testRemoveOrphansOnList");
assertEquals(3, myClassB.getAStringList().size());
assertTrue(myClassB.getAStringList().contains(apple));
assertTrue(myClassB.getAStringList().contains(banana));
assertTrue(myClassB.getAStringList().contains(kiwiFruit));
assertFalse(myClassB.getAStringList().contains(grape));
assertFalse(myClassB.getAStringList().contains(orange));
}