edu.udayton.udri.asset.canon.ipcamera/test/edu/udayton/udri/asset/canon/ipcamera/TestIpCameraAsset.java
@Test(expected = CommandExecutionException.class)
    public void testSetPanIoException1() throws IOException, InterruptedException, AssetException
    {
        m_SUT.onActivate();
        SetPanTiltCommand setPanTiltCommand = new SetPanTiltCommand();
        final AzimuthDegrees panAzimuthDegrees = new AzimuthDegrees();
        panAzimuthDegrees.setValue(7);
        final OrientationOffset panOrientationOffset = new OrientationOffset();
        panOrientationOffset.setElevation(null);
        panOrientationOffset.setAzimuth(panAzimuthDegrees);
        setPanTiltCommand.setPanTilt(panOrientationOffset);
        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 handleSetPan method tries to create connection to the URL
Catches IO exception when handleSetPan method tries to create connection to the URL
Catches IO exception when handleSetPan method tries to create connection to the URL
@Test(expected = CommandExecutionException.class)
    public void testSetPanIoException1() throws IOException, InterruptedException, AssetException
    {
        m_SUT.onActivate();
        SetPanTiltCommand setPanTiltCommand = new SetPanTiltCommand();
        final AzimuthDegrees panAzimuthDegrees = new AzimuthDegrees();
        panAzimuthDegrees.setValue(7);
        final OrientationOffset panOrientationOffset = new OrientationOffset();
        panOrientationOffset.setElevation(null);
        panOrientationOffset.setAzimuth(panAzimuthDegrees);
        setPanTiltCommand.setPanTilt(panOrientationOffset);
        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 testSetPanIoException1 ( ) throws IOException , InterruptedException , AssetException { m_SUT . onActivate ( ) ; SetPanTiltCommand setPanTiltCommand = new SetPanTiltCommand ( ) ; final AzimuthDegrees panAzimuthDegrees = new AzimuthDegrees ( ) ; panAzimuthDegrees . setValue ( 7 ) ; final OrientationOffset panOrientationOffset = new OrientationOffset ( ) ; panOrientationOffset . setElevation ( null ) ; panOrientationOffset . setAzimuth ( panAzimuthDegrees ) ; setPanTiltCommand . setPanTilt ( panOrientationOffset ) ; 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 handleSetPan method tries to create connection to the URL
Catches IO exception when handleSetPan method tries to create connection to the URL