mil.dod.th.ose.shell/test/mil/dod/th/ose/shell/TestPowerManagerCommands.java
@Test
    public void testGetWakeLockForFactoryObject()
    {
        FactoryObject factoryObj = mock(FactoryObject.class);
        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, "id1");
        assertThat(lock, notNullValue());
        assertThat(lock.getId(), is("id1"));
        assertThat(lock.getSourceObject(), is(factoryObj));
    }
/**
     * Verify that only locks for a given factory object are returned.
     */
Verify that only locks for a given factory object are returned.
Verify that only locks for a given factory object are returned .
@Test
    public void testGetWakeLockForFactoryObject()
    {
        FactoryObject factoryObj = mock(FactoryObject.class);
        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, "id1");
        assertThat(lock, notNullValue());
        assertThat(lock.getId(), is("id1"));
        assertThat(lock.getSourceObject(), is(factoryObj));
    }
@ Test public void testGetWakeLockForFactoryObject ( ) { FactoryObject factoryObj = mock ( FactoryObject . class ) ; 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 , "id1" ) ; assertThat ( lock , notNullValue ( ) ) ; assertThat ( lock . getId ( ) , is ( "id1" ) ) ; assertThat ( lock . getSourceObject ( ) , is ( factoryObj ) ) ; }
Verify that only locks for a given factory object are returned.
Verify that only locks for a given factory object are returned .