MessengerDataService { public void purgeExpiredMessages() { messageDao.purgeMessages(); } MessengerDataService( EntityManagerFactory entityManagerFactory ); void purgeExpiredMessages(); Set<Envelope> getEnvelopes(); void markAsSent( Envelope envelope ); void incrementDeliveryAttempts( Envelope envelope ); void saveEnvelope( Envelope envelope ); Envelope getEnvelope( UUID messageId );  }
@Test public void testPurgeExpiredMessages() throws Exception { messengerDataService.purgeExpiredMessages(); verify( messageDao ).purgeMessages(); }