edu.udayton.udri.asset.canon.ipcamera/test/edu/udayton/udri/asset/canon/ipcamera/TestIpCameraAsset.java
@Test(expected = CommandExecutionException.class)
    public void testSetTiltIoException2() throws IOException, InterruptedException, AssetException
    {
        m_SUT.onActivate();
        SetPanTiltCommand setPanTiltCommand = new SetPanTiltCommand();
        final ElevationDegrees tiltElevationDegrees = new ElevationDegrees();
        tiltElevationDegrees.setValue(17);
        final OrientationOffset orientationOffset = new OrientationOffset();
        orientationOffset.setElevation(tiltElevationDegrees);
        orientationOffset.setAzimuth(null);
        setPanTiltCommand.setPanTilt(orientationOffset);
        when(m_Context.getActiveStatus()).thenReturn(AssetActiveStatus.ACTIVATED);
        when(m_UrlUtil.getInputStream(any(URL.class))).thenThrow(new IOException());
        m_SUT.onExecuteCommand(setPanTiltCommand);
    }
//Catches IO exception when handleSetTilt method tries to create connection to the URL
Catches IO exception when handleSetTilt method tries to create connection to the URL
Catches IO exception when handleSetTilt method tries to create connection to the URL
@Test(expected = CommandExecutionException.class)
    public void testSetTiltIoException2() throws IOException, InterruptedException, AssetException
    {
        m_SUT.onActivate();
        SetPanTiltCommand setPanTiltCommand = new SetPanTiltCommand();
        final ElevationDegrees tiltElevationDegrees = new ElevationDegrees();
        tiltElevationDegrees.setValue(17);
        final OrientationOffset orientationOffset = new OrientationOffset();
        orientationOffset.setElevation(tiltElevationDegrees);
        orientationOffset.setAzimuth(null);
        setPanTiltCommand.setPanTilt(orientationOffset);
        when(m_Context.getActiveStatus()).thenReturn(AssetActiveStatus.ACTIVATED);
        when(m_UrlUtil.getInputStream(any(URL.class))).thenThrow(new IOException());
        m_SUT.onExecuteCommand(setPanTiltCommand);
    }
@ Test ( expected = CommandExecutionException . class ) public void testSetTiltIoException2 ( ) throws IOException , InterruptedException , AssetException { m_SUT . onActivate ( ) ; SetPanTiltCommand setPanTiltCommand = new SetPanTiltCommand ( ) ; final ElevationDegrees tiltElevationDegrees = new ElevationDegrees ( ) ; tiltElevationDegrees . setValue ( 17 ) ; final OrientationOffset orientationOffset = new OrientationOffset ( ) ; orientationOffset . setElevation ( tiltElevationDegrees ) ; orientationOffset . setAzimuth ( null ) ; setPanTiltCommand . setPanTilt ( orientationOffset ) ; when ( m_Context . getActiveStatus ( ) ) . thenReturn ( AssetActiveStatus . ACTIVATED ) ; when ( m_UrlUtil . getInputStream ( any ( URL . class ) ) ) . thenThrow ( new IOException ( ) ) ; m_SUT . onExecuteCommand ( setPanTiltCommand ) ; }
Catches IO exception when handleSetTilt method tries to create connection to the URL
Catches IO exception when handleSetTilt method tries to create connection to the URL