@Test
public void testCustomMappingForAsbstractDestClassCollection() throws Exception {
mapper = getMapper("abstractMapping.xml");
AbstractACollectionContainer src = getAsContainer();
AbstractBCollectionContainer dest = mapper.map(src, AbstractBCollectionContainer.class);
assertTrue(dest.getBs().get(0) instanceof B);
assertNull("abstractField1 should have been excluded", dest.getBs().get(0).getAbstractField1());
assertEquals("abstractBField not mapped correctly", src.getAs().get(0).getAbstractAField(), dest.getBs().get(0).getAbstractBField());
assertEquals("field1 not mapped correctly", ((A)src.getAs().get(0)).getField1(), ((B)dest.getBs().get(0)).getField1());
assertEquals("fieldB not mapped correctly", ((A)src.getAs().get(0)).getFieldA(), ((B)dest.getBs().get(0)).getFieldB());
// Remap to each other to test bi-directional mapping
AbstractACollectionContainer mappedSrc = mapper.map(dest, AbstractACollectionContainer.class);
AbstractBCollectionContainer mappedDest = mapper.map(mappedSrc, AbstractBCollectionContainer.class);
assertEquals("objects not mapped correctly bi-directional", dest, mappedDest);
}