@Test( expected = MessageException.class )
public void testGetMessageStatus() throws Exception
{

    Envelope envelope = mock( Envelope.class );
    when( envelope.isSent() ).thenReturn( false );
    //test NOT_FOUND
    MessageStatus status = messenger.getMessageStatus( MESSAGE_ID );
    assertEquals( MessageStatus.NOT_FOUND, status );
    when( messengerDataService.getEnvelope( MESSAGE_ID ) ).thenReturn( envelope );
    //test IN_PROCESS
    when( envelope.getTimeToLive() ).thenReturn( TIME_TO_LIVE );
    Timestamp createDate = mock( Timestamp.class );
    when( envelope.getCreateDate() ).thenReturn( createDate );
    when( createDate.getTime() ).thenReturn( System.currentTimeMillis() - 1000000 );
    status = messenger.getMessageStatus( MESSAGE_ID );
    assertEquals( MessageStatus.EXPIRED, status );
    //test EXPIRED
    when( createDate.getTime() ).thenReturn( System.currentTimeMillis() + 1000000 );
    status = messenger.getMessageStatus( MESSAGE_ID );
    assertEquals( MessageStatus.IN_PROCESS, status );
    //test SENT
    when( envelope.isSent() ).thenReturn( true );
    status = messenger.getMessageStatus( MESSAGE_ID );
    assertEquals( MessageStatus.SENT, status );
    //test exception
    doThrow( new RuntimeException() ).when( messengerDataService ).getEnvelope( any( UUID.class ) );
    messenger.getMessageStatus( MESSAGE_ID );
}