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