EnvironmentAlertHandlersImpl implements EnvironmentAlertHandlers { @Override public Map<EnvironmentAlertHandler, AlertHandler> getAllHandlers() { return handlers; } EnvironmentAlertHandlersImpl( final EnvironmentId environmentId ); @Override void add( EnvironmentAlertHandler environmentAlertHandler, AlertHandler alertHandler ); @Override EnvironmentId getEnvironmentId(); @Override Map<EnvironmentAlertHandler, AlertHandler> getAllHandlers(); @Override @SuppressWarnings( "unchecked" ) Collection<AlertHandler> getEffectiveHandlers(); @Override AlertHandler getHandler( final EnvironmentAlertHandler handlerId );  }
@Test public void testGetAllHandlers() { environmentAlertHandlers.add( lowId, lowHandler); environmentAlertHandlers.add( highId, highHandler ); environmentAlertHandlers.add( normalId, normalHandler); environmentAlertHandlers.add( nullHandlerId, null ); final Map<EnvironmentAlertHandler, AlertHandler> allHandlers = environmentAlertHandlers.getAllHandlers(); final Iterator<EnvironmentAlertHandler> i = allHandlers.keySet().iterator(); assertEquals( 4, allHandlers.size() ); EnvironmentAlertHandler id = i.next(); assertEquals( highId, id ); id = i.next(); assertEquals( normalId, id ); id = i.next(); assertEquals( nullHandlerId, id ); id = i.next(); assertEquals( lowId, id ); final Iterator<AlertHandler> i2 = allHandlers.values().iterator(); assertEquals( 4, allHandlers.size() ); AlertHandler h = i2.next(); assertEquals( highHandler, h ); h = i2.next(); assertEquals( normalHandler, h ); h = i2.next(); assertEquals( null, h ); h = i2.next(); assertEquals( lowHandler, h ); }