@Test
public void testDeepMapIndexed() throws Exception {
Mapper mapper = getMapper(new String[] { "genericCollectionMapping.xml" });
Pet[] myPets = new Pet[2];
Family source = newInstance(Family.class, new Object[] {"john", "jane", "doe", new Integer(22000), new Integer(20000)});
Pet firstPet = newInstance(Pet.class, new Object[] {"molly", 2});
myPets[0] = firstPet;
Pet[] offSprings = new Pet[4];
offSprings[0] = newInstance(Pet.class, new Object[] {"Rocky1", 1});
offSprings[1] = newInstance(Pet.class, new Object[] {"Rocky2", 1});
offSprings[2] = newInstance(Pet.class, new Object[] {"Rocky3", 1});
offSprings[3] = newInstance(Pet.class, new Object[] {"Rocky4", 1});
Pet secondPet = newInstance(Pet.class, new Object[] {"Rocky", 3, offSprings});
myPets[1] = secondPet;
// Save the pet details into the source object
source.setPets(myPets);
HeadOfHouseHold dest = mapper.map(source, HeadOfHouseHold.class);
assertEquals((source.getFamilyMembers().get(0)).getFirstName(), dest.getFirstName());
assertEquals((source.getFamilyMembers().get(0)).getLastName(), dest.getLastName());
assertEquals((source.getFamilyMembers().get(0)).getSalary(), dest.getSalary());
assertEquals(source.getPets()[1].getPetName(), dest.getPetName());
assertEquals(String.valueOf(source.getPets()[1].getPetAge()), dest.getPetAge());
assertEquals(source.getPets()[1].getOffSpring()[2].getPetName(), dest.getOffSpringName());
}