MessengerDataService { protected Set<Envelope> buildEnvelopes( final List<MessageEntity> messages ) { Set<Envelope> result = Sets.newHashSet(); for ( final MessageEntity message : messages ) { Envelope envelope = new Envelope( message ); result.add( envelope ); } return result; } 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 testBuildEnvelopes() throws Exception { Set<Envelope> envelopeSet = messengerDataService.buildEnvelopes( Lists.newArrayList( messageEntity ) ); assertFalse( envelopeSet.isEmpty() ); }