MessengerDataService { public void incrementDeliveryAttempts( Envelope envelope ) { messageDao.incrementDeliveryAttempts( envelope.getMessage().getId().toString() ); } 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 testIncrementDeliveryAttempts() throws Exception { messengerDataService.incrementDeliveryAttempts( envelope ); verify( messageDao ).incrementDeliveryAttempts( eq( envelope.getMessage().getId().toString() ) ); }