edu.udayton.udri.asset.novatel/test/edu/udayton/udri/asset/novatel/impl/connection/TestNovatelConnectionMgrImpl.java
@Test
    public void testNullPortBaudRateReconnect() throws AssetException, IOException, IllegalArgumentException, 
        CCommException, PhysicalLinkException
    {
        //try with nothing set... both are null
        try
        {
            m_SUT.reconnect();
            fail("Expecting exception.");
        }
        catch (IllegalStateException e)
        {
            //expected exception
        }
        //start processing call, but with name of the port being null
        when(m_CustomCommService.tryCreatePhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT, null)).thenReturn(m_UUID);
        when(m_CustomCommService.requestPhysicalLink(m_UUID)).thenReturn(m_SerialPort);
        when(m_SerialPort.getInputStream()).thenReturn(mock(InputStream.class));
        m_SUT.startProcessing(null, m_BaudRate);
        
        //try with port being null
        try
        {
            m_SUT.reconnect();
            fail("Expecting exception.");
        }
        catch (IllegalStateException e)
        {
            //expected exception
        }
    }
/**
     * Test the Illegal state exception if reconnect is called and the baudrate and/or port are null.
     */
Test the Illegal state exception if reconnect is called and the baudrate and/or port are null.
Test the Illegal state exception if reconnect is called and the baudrate and / or port are null .
@Test
    public void testNullPortBaudRateReconnect() throws AssetException, IOException, IllegalArgumentException, 
        CCommException, PhysicalLinkException
    {
        try
        {
            m_SUT.reconnect();
            fail("Expecting exception.");
        }
        catch (IllegalStateException e)
        {
        }
        when(m_CustomCommService.tryCreatePhysicalLink(PhysicalLinkTypeEnum.SERIAL_PORT, null)).thenReturn(m_UUID);
        when(m_CustomCommService.requestPhysicalLink(m_UUID)).thenReturn(m_SerialPort);
        when(m_SerialPort.getInputStream()).thenReturn(mock(InputStream.class));
        m_SUT.startProcessing(null, m_BaudRate);
        try
        {
            m_SUT.reconnect();
            fail("Expecting exception.");
        }
        catch (IllegalStateException e)
        {
        }
    }
@ Test public void testNullPortBaudRateReconnect ( ) throws AssetException , IOException , IllegalArgumentException , CCommException , PhysicalLinkException { try { m_SUT . reconnect ( ) ; fail ( "Expecting exception." ) ; } catch ( IllegalStateException e ) { } when ( m_CustomCommService . tryCreatePhysicalLink ( PhysicalLinkTypeEnum . SERIAL_PORT , null ) ) . thenReturn ( m_UUID ) ; when ( m_CustomCommService . requestPhysicalLink ( m_UUID ) ) . thenReturn ( m_SerialPort ) ; when ( m_SerialPort . getInputStream ( ) ) . thenReturn ( mock ( InputStream . class ) ) ; m_SUT . startProcessing ( null , m_BaudRate ) ; try { m_SUT . reconnect ( ) ; fail ( "Expecting exception." ) ; } catch ( IllegalStateException e ) { } }
Test the Illegal state exception if reconnect is called and the baudrate and/or port are null.
Test the Illegal state exception if reconnect is called and the baudrate and / or port are null .
//try with nothing set... both are null //expected exception //start processing call, but with name of the port being null //try with port being null //expected exception