assertEquals(0, afterSaveListener.seenEvents.size());
assertEquals(0, simpleMappingEventListener.onBeforeSaveEvents.size());
assertEquals(0, simpleMappingEventListener.onAfterSaveEvents.size());
PersonPojoStringId p = new PersonPojoStringId("1", "Text");
template.insert(p);
assertEquals(1, personBeforeSaveListener.seenEvents.size());
assertEquals(1, afterSaveListener.seenEvents.size());
assertEquals(1, simpleMappingEventListener.onBeforeSaveEvents.size());
assertEquals(1, simpleMappingEventListener.onAfterSaveEvents.size());
Assert.assertTrue(personBeforeSaveListener.seenEvents.get(0) instanceof BeforeSaveEvent<?>);
Assert.assertTrue(afterSaveListener.seenEvents.get(0) instanceof AfterSaveEvent<?>);
BeforeSaveEvent<PersonPojoStringId> beforeSaveEvent = (BeforeSaveEvent<PersonPojoStringId>) personBeforeSaveListener.seenEvents
.get(0);
PersonPojoStringId p2 = beforeSaveEvent.getSource();
DBObject dbo = beforeSaveEvent.getDBObject();
comparePersonAndDbo(p, p2, dbo);
AfterSaveEvent<Object> afterSaveEvent = (AfterSaveEvent<Object>) afterSaveListener.seenEvents.get(0);