mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/TestQueuedMessageSender.java
@Test
    public void testQueuingInitialSuccess() throws InterruptedException
    {
        TerraHarvestMessage message = constructMessage(1);
        
        // mock channel to send messages successfully
        when(m_Channel.trySendMessage(Mockito.any(TerraHarvestMessage.class))).thenReturn(true);
        
        // queue a single message
        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(1000);
        
        // verify actually sent to channel and only once
        verify(m_Channel, times(1)).trySendMessage(message);
    }
/**
     * Verify that a queued message will be sent to the channel for an attempt to send.
     * 
     * Verify only attempted once since the first attempt is successful.
     */
Verify that a queued message will be sent to the channel for an attempt to send.

Verify only attempted once since the first attempt is successful.
Verify that a queued message will be sent to the channel for an attempt to send . Verify only attempted once since the first attempt is successful .
@Test
    public void testQueuingInitialSuccess() throws InterruptedException
    {
        TerraHarvestMessage message = constructMessage(1);
        when(m_Channel.trySendMessage(Mockito.any(TerraHarvestMessage.class))).thenReturn(true);
        boolean result = m_SUT.queue(message);
        assertThat("message is reported as queued", result, is(true));
        Thread.sleep(1000);
        verify(m_Channel, times(1)).trySendMessage(message);
    }
@ Test public void testQueuingInitialSuccess ( ) throws InterruptedException { TerraHarvestMessage message = constructMessage ( 1 ) ; when ( m_Channel . trySendMessage ( Mockito . any ( TerraHarvestMessage . class ) ) ) . thenReturn ( true ) ; boolean result = m_SUT . queue ( message ) ; assertThat ( "message is reported as queued" , result , is ( true ) ) ; Thread . sleep ( 1000 ) ; verify ( m_Channel , times ( 1 ) ) . trySendMessage ( message ) ; }
Verify that a queued message will be sent to the channel for an attempt to send.
Verify that a queued message will be sent to the channel for an attempt to send .
// mock channel to send messages successfully // queue a single message // wait for the sender thread to attempt sending message // verify actually sent to channel and only once