mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestQueuedMessageSender.java
@Test
    public void testQueueingWithInitialFailure() throws InterruptedException
    {
        TerraHarvestMessage message = constructMessage(1);
        
        // change channel to not send messages temporarily
        when(m_Channel.trySendMessage(Mockito.any(TerraHarvestMessage.class))).thenReturn(false);
        
        boolean result = m_SUT.queue(message);
        assertThat("message is reported as queued", result, is(true));
        
        // wait for the sender thread to attempt sending message
        Thread.sleep(2000);
        
        // verify message was attempted multiple times, retry is 1000, slept 2000, so should be 2-3 times depending on 
        // timing
        verify(m_Channel, atLeast(2)).trySendMessage(message);
        verify(m_Channel, atMost(3)).trySendMessage(message);
    }
/**
     * Verify that is the send fails, the component will attempt to send again until successful.
     */
Verify that is the send fails, the component will attempt to send again until successful.
Verify that is the send fails the component will attempt to send again until successful .
@Test
    public void testQueueingWithInitialFailure() throws InterruptedException
    {
        TerraHarvestMessage message = constructMessage(1);
        when(m_Channel.trySendMessage(Mockito.any(TerraHarvestMessage.class))).thenReturn(false);
        boolean result = m_SUT.queue(message);
        assertThat("message is reported as queued", result, is(true));
        Thread.sleep(2000);
        verify(m_Channel, atLeast(2)).trySendMessage(message);
        verify(m_Channel, atMost(3)).trySendMessage(message);
    }
@ Test public void testQueueingWithInitialFailure ( ) throws InterruptedException { TerraHarvestMessage message = constructMessage ( 1 ) ; when ( m_Channel . trySendMessage ( Mockito . any ( TerraHarvestMessage . class ) ) ) . thenReturn ( false ) ; boolean result = m_SUT . queue ( message ) ; assertThat ( "message is reported as queued" , result , is ( true ) ) ; Thread . sleep ( 2000 ) ; verify ( m_Channel , atLeast ( 2 ) ) . trySendMessage ( message ) ; verify ( m_Channel , atMost ( 3 ) ) . trySendMessage ( message ) ; }
Verify that is the send fails, the component will attempt to send again until successful.
Verify that is the send fails the component will attempt to send again until successful .
// change channel to not send messages temporarily // wait for the sender thread to attempt sending message // verify message was attempted multiple times, retry is 1000, slept 2000, so should be 2-3 times depending on  // timing