/** @see DATAMONGO-545 */ @Test public void invokeContactCallbackForPersonEvent() { MongoMappingEvent<DBObject> event = new BeforeDeleteEvent<Person>(new BasicDBObject(), Person.class); SampleContactEventListener listener = new SampleContactEventListener(); listener.onApplicationEvent(event); assertThat(listener.invokedOnBeforeDelete, is(true)); }
/** @see DATAMONGO-289 */ @Test public void afterLoadEventGetsFilteredForDomainTypeWorksForSubtypes() { SamplePersonEventListener personListener = new SamplePersonEventListener(); SampleContactEventListener contactListener = new SampleContactEventListener(); personListener.onApplicationEvent( new AfterLoadEvent<Person>(new BasicDBObject(), Person.class)); contactListener.onApplicationEvent( new AfterLoadEvent<Person>(new BasicDBObject(), Person.class)); assertThat(personListener.invokedOnAfterLoad, is(true)); assertThat(contactListener.invokedOnAfterLoad, is(true)); }