mil.dod.th.ose.shell/test/mil/dod/th/ose/shell/TestPowerManagerCommands.java
@Test
    public void testGetWakeLockForFactoryObjNoWakeLocks()
    {
        FactoryObject factoryObj = mock(FactoryObject.class);
        when(factoryObj.getName()).thenReturn("name");
        Set<WakeLock> locksToReturn = new HashSet<>();
        
        when(m_PowerManager.getWakeLocks(factoryObj, WakeLockState.Any)).thenReturn(locksToReturn);
        
        WakeLock lock = m_SUT.getWakeLock(m_Session, factoryObj, "id1");
        assertThat(lock, nullValue());
        
        verify(m_PrintStream).format("Cannot find a WakeLock with the given factory object %s and lock id %s", 
                "name", "id1");        
    }
/**
     * Verify that command session outputs the correct error message if no
     * wake locks can be found for a given factory object.
     */
Verify that command session outputs the correct error message if no
wake locks can be found for a given factory object.
Verify that command session outputs the correct error message if no wake locks can be found for a given factory object .
@Test
    public void testGetWakeLockForFactoryObjNoWakeLocks()
    {
        FactoryObject factoryObj = mock(FactoryObject.class);
        when(factoryObj.getName()).thenReturn("name");
        Set<WakeLock> locksToReturn = new HashSet<>();
        when(m_PowerManager.getWakeLocks(factoryObj, WakeLockState.Any)).thenReturn(locksToReturn);
        WakeLock lock = m_SUT.getWakeLock(m_Session, factoryObj, "id1");
        assertThat(lock, nullValue());
        verify(m_PrintStream).format("Cannot find a WakeLock with the given factory object %s and lock id %s", 
                "name", "id1");        
    }
@ Test public void testGetWakeLockForFactoryObjNoWakeLocks ( ) { FactoryObject factoryObj = mock ( FactoryObject . class ) ; when ( factoryObj . getName ( ) ) . thenReturn ( "name" ) ; Set < WakeLock > locksToReturn = new HashSet < > ( ) ; when ( m_PowerManager . getWakeLocks ( factoryObj , WakeLockState . Any ) ) . thenReturn ( locksToReturn ) ; WakeLock lock = m_SUT . getWakeLock ( m_Session , factoryObj , "id1" ) ; assertThat ( lock , nullValue ( ) ) ; verify ( m_PrintStream ) . format ( "Cannot find a WakeLock with the given factory object %s and lock id %s" , "name" , "id1" ) ; }
Verify that command session outputs the correct error message if no
 wake locks can be found for a given factory object.
Verify that command session outputs the correct error message if no wake locks can be found for a given factory object .