mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPowerManager.java
public void testDeleteWakeLock()
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        
        // Create test lock to delete
        WakeLock testLock = powerManager.createWakeLock(TestPowerManager.class, "TestDeleteLock");
        testLock.activate();
        
        // Check that test lock has been activated
        Set<WakeLock> activeLocks = powerManager.getWakeLocks(TestPowerManager.class, WakeLockState.Active);
        assertThat(activeLocks, hasItem(testLock));     
        
        // Delete created lock
        testLock.delete();
        
        // Check that lock has been deleted
        activeLocks = powerManager.getWakeLocks(TestPowerManager.class, WakeLockState.Any);
        assertThat(activeLocks, not(hasItem(testLock)));      
    }
/**
     * Verifies that a WakeLock can be deleted
     */
Verifies that a WakeLock can be deleted
Verifies that a WakeLock can be deleted
public void testDeleteWakeLock()
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        WakeLock testLock = powerManager.createWakeLock(TestPowerManager.class, "TestDeleteLock");
        testLock.activate();
        Set<WakeLock> activeLocks = powerManager.getWakeLocks(TestPowerManager.class, WakeLockState.Active);
        assertThat(activeLocks, hasItem(testLock));     
        testLock.delete();
        activeLocks = powerManager.getWakeLocks(TestPowerManager.class, WakeLockState.Any);
        assertThat(activeLocks, not(hasItem(testLock)));      
    }
public void testDeleteWakeLock ( ) { PowerManager powerManager = ServiceUtils . getService ( m_Context , PowerManager . class ) ; assertThat ( powerManager , is ( notNullValue ( ) ) ) ; WakeLock testLock = powerManager . createWakeLock ( TestPowerManager . class , "TestDeleteLock" ) ; testLock . activate ( ) ; Set < WakeLock > activeLocks = powerManager . getWakeLocks ( TestPowerManager . class , WakeLockState . Active ) ; assertThat ( activeLocks , hasItem ( testLock ) ) ; testLock . delete ( ) ; activeLocks = powerManager . getWakeLocks ( TestPowerManager . class , WakeLockState . Any ) ; assertThat ( activeLocks , not ( hasItem ( testLock ) ) ) ; }
Verifies that a WakeLock can be deleted
Verifies that a WakeLock can be deleted
// Create test lock to delete // Check that test lock has been activated // Delete created lock // Check that lock has been deleted