edu.udayton.udri.asset.canon.ipcamera/test/edu/udayton/udri/asset/canon/ipcamera/TestIpCameraAsset.java
@Test(expected = CommandExecutionException.class)
    public void testGetTiltIoException2() throws IOException, InterruptedException, AssetException
    {
        m_SUT.onActivate();
        GetPanTiltCommand fakeGetPanTilt = new GetPanTiltCommand();
        URLConnection urlCon = mock(URLConnection.class);
        when(m_Context.getActiveStatus()).thenReturn(AssetActiveStatus.ACTIVATED);
        when(m_UrlUtil.getConnection(any(URL.class))).thenReturn(urlCon).thenReturn(urlCon);
        when(m_UrlUtil.getInputStream(any(URLConnection.class)))
            .thenThrow(new IOException()).thenThrow(new IOException());
        m_SUT.onExecuteCommand(fakeGetPanTilt);
    }
//Catches the IO exception in the handleGetTilt when trying to create an Input Stream
Catches the IO exception in the handleGetTilt when trying to create an Input Stream
Catches the IO exception in the handleGetTilt when trying to create an Input Stream
@Test(expected = CommandExecutionException.class)
    public void testGetTiltIoException2() throws IOException, InterruptedException, AssetException
    {
        m_SUT.onActivate();
        GetPanTiltCommand fakeGetPanTilt = new GetPanTiltCommand();
        URLConnection urlCon = mock(URLConnection.class);
        when(m_Context.getActiveStatus()).thenReturn(AssetActiveStatus.ACTIVATED);
        when(m_UrlUtil.getConnection(any(URL.class))).thenReturn(urlCon).thenReturn(urlCon);
        when(m_UrlUtil.getInputStream(any(URLConnection.class)))
            .thenThrow(new IOException()).thenThrow(new IOException());
        m_SUT.onExecuteCommand(fakeGetPanTilt);
    }
@ Test ( expected = CommandExecutionException . class ) public void testGetTiltIoException2 ( ) throws IOException , InterruptedException , AssetException { m_SUT . onActivate ( ) ; GetPanTiltCommand fakeGetPanTilt = new GetPanTiltCommand ( ) ; URLConnection urlCon = mock ( URLConnection . class ) ; when ( m_Context . getActiveStatus ( ) ) . thenReturn ( AssetActiveStatus . ACTIVATED ) ; when ( m_UrlUtil . getConnection ( any ( URL . class ) ) ) . thenReturn ( urlCon ) . thenReturn ( urlCon ) ; when ( m_UrlUtil . getInputStream ( any ( URLConnection . class ) ) ) . thenThrow ( new IOException ( ) ) . thenThrow ( new IOException ( ) ) ; m_SUT . onExecuteCommand ( fakeGetPanTilt ) ; }
Catches the IO exception in the handleGetTilt when trying to create an Input Stream
Catches the IO exception in the handleGetTilt when trying to create an Input Stream