mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/pm/TestWakeLockImpl.java
@Test
    public void testActivateWakeLockDate()
    {
        ArgumentCaptor<Long> startTimeCapture = ArgumentCaptor.forClass(Long.class);
        ArgumentCaptor<Long> stopTimeCapture = ArgumentCaptor.forClass(Long.class);

        long wakeDurationMs = 60000;

        // Create time one minute from now
        Date currentTime = new Date();
        Date lockAwakeTime = DateUtils.addMinutes(currentTime, 1);
        m_SUT.activate(lockAwakeTime);

        verify(m_PPM).activateWakeLock(eq(m_SUT), startTimeCapture.capture(), stopTimeCapture.capture());
        assertThat(stopTimeCapture.getValue() - startTimeCapture.getValue(), greaterThan(wakeDurationMs - 100));
        assertThat(stopTimeCapture.getValue() - startTimeCapture.getValue(), lessThanOrEqualTo(wakeDurationMs));
    }
/**
     * Test method for {@link WakeLockImpl#activate(java.util.Date)} when {@link PlatformPowerManager} is
     * available.
     */
Test method for  WakeLockImpl#activate(java.util.Date) when  PlatformPowerManager is
available.
Test method for WakeLockImpl#activate ( java . util . Date ) when PlatformPowerManager is available .
@Test
    public void testActivateWakeLockDate()
    {
        ArgumentCaptor<Long> startTimeCapture = ArgumentCaptor.forClass(Long.class);
        ArgumentCaptor<Long> stopTimeCapture = ArgumentCaptor.forClass(Long.class);
        long wakeDurationMs = 60000;
        Date currentTime = new Date();
        Date lockAwakeTime = DateUtils.addMinutes(currentTime, 1);
        m_SUT.activate(lockAwakeTime);
        verify(m_PPM).activateWakeLock(eq(m_SUT), startTimeCapture.capture(), stopTimeCapture.capture());
        assertThat(stopTimeCapture.getValue() - startTimeCapture.getValue(), greaterThan(wakeDurationMs - 100));
        assertThat(stopTimeCapture.getValue() - startTimeCapture.getValue(), lessThanOrEqualTo(wakeDurationMs));
    }
@ Test public void testActivateWakeLockDate ( ) { ArgumentCaptor < Long > startTimeCapture = ArgumentCaptor . forClass ( Long . class ) ; ArgumentCaptor < Long > stopTimeCapture = ArgumentCaptor . forClass ( Long . class ) ; long wakeDurationMs = 60000 ; Date currentTime = new Date ( ) ; Date lockAwakeTime = DateUtils . addMinutes ( currentTime , 1 ) ; m_SUT . activate ( lockAwakeTime ) ; verify ( m_PPM ) . activateWakeLock ( eq ( m_SUT ) , startTimeCapture . capture ( ) , stopTimeCapture . capture ( ) ) ; assertThat ( stopTimeCapture . getValue ( ) - startTimeCapture . getValue ( ) , greaterThan ( wakeDurationMs - 100 ) ) ; assertThat ( stopTimeCapture . getValue ( ) - startTimeCapture . getValue ( ) , lessThanOrEqualTo ( wakeDurationMs ) ) ; }
Test method for {@link WakeLockImpl#activate(java.util.Date)} when {@link PlatformPowerManager} is
 available.
Test method for { @link WakeLockImpl#activate ( java . util . Date ) } when { @link PlatformPowerManager } is available .
// Create time one minute from now