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