mil.dod.th.remote.client/test/mil/dod/th/remote/client/impl/TestMessageSenderServiceImpl.java
@Test
    public void testSendRequestErrorNullCallback() throws IOException
    {
        // Setup
        m_SUT.setClientId(CLIENT_ID);
        m_SUT.addRemoteChannel(DEST_ID, m_OutStream, null);
        TerraHarvestPayload payload = createPayload();

        // Mock
        doThrow(IOException.class).when(m_OutStream).write(Mockito.any(byte[].class), anyInt(), anyInt());

        // Replay
        try
        {
            m_SUT.sendRequest(DEST_ID, payload);
            fail("sendRequest should throw IOException");
        }
        catch (IOException e)
        {
            // Expected
        }
    }
/**
     * Verify that sending a request message on a bad output stream can handle a null callback.
     */
Verify that sending a request message on a bad output stream can handle a null callback.
Verify that sending a request message on a bad output stream can handle a null callback .
@Test
    public void testSendRequestErrorNullCallback() throws IOException
    {
        m_SUT.setClientId(CLIENT_ID);
        m_SUT.addRemoteChannel(DEST_ID, m_OutStream, null);
        TerraHarvestPayload payload = createPayload();
        doThrow(IOException.class).when(m_OutStream).write(Mockito.any(byte[].class), anyInt(), anyInt());
        try
        {
            m_SUT.sendRequest(DEST_ID, payload);
            fail("sendRequest should throw IOException");
        }
        catch (IOException e)
        {
        }
    }
@ Test public void testSendRequestErrorNullCallback ( ) throws IOException { m_SUT . setClientId ( CLIENT_ID ) ; m_SUT . addRemoteChannel ( DEST_ID , m_OutStream , null ) ; TerraHarvestPayload payload = createPayload ( ) ; doThrow ( IOException . class ) . when ( m_OutStream ) . write ( Mockito . any ( byte [ ] . class ) , anyInt ( ) , anyInt ( ) ) ; try { m_SUT . sendRequest ( DEST_ID , payload ) ; fail ( "sendRequest should throw IOException" ) ; } catch ( IOException e ) { } }
Verify that sending a request message on a bad output stream can handle a null callback.
Verify that sending a request message on a bad output stream can handle a null callback .
// Setup // Mock // Replay // Expected