### Question:
AlarmManager extends AbstractStartable implements Runnable { private void wakeup( Alarm alarm ) { try { int delay = alarm.listener.wakeup( this, alarm.getState(), alarm.getDue() ); if (delay != 0) update( alarm, delay ); else remove( alarm ); } catch ( Exception e ) { remove( alarm ); report( e ); } } AlarmManager( int nWorkers );  AlarmManager(); static void staticAdd( AlarmListener listener, Object state, int delay ); static void staticRemove( AlarmListener listener ); static AlarmManager getAlarmManager( boolean startIt ); static AlarmManager setAlarmManager( AlarmManager newAlarmManager ); synchronized void add( AlarmListener listener, Object state, int delay ); synchronized void remove( AlarmListener listener ); void run(); static void shutdown(); final static int DEFAULT_NWORKERS; }### Answer:
@Test public void listener1() throws Exception { assertEquals( 0, listener.delay ); assertFalse( listener.wake.get() ); assertNull( listener.state ); listener.wakeup( null, null, 12345 ); assertEquals( 0, listener.delay ); assertTrue( listener.wake.get() ); assertNull( listener.state ); listener.wakeup( null, s1, 23456 ); assertEquals( 0, listener.delay ); assertTrue( listener.wake.get() ); assertSame( s1, listener.state ); MyAlarmListener listener1 = new MyAlarmListener( 1 ); assertEquals( 1, listener1.delay ); }