@Test
public void testHandleAlertPack() throws Exception
{

    EnvironmentAlertHandlers environmentAlertHandlers = mock( EnvironmentAlertHandlers.class );
    EnvironmentAlertHandler environmentAlertHandler = mock( EnvironmentAlertHandler.class );
    AlertEvent alertEvent = mock( AlertEvent.class );
    doReturn( TestHelper.ENV_ID ).when( alertEvent ).getEnvironmentId();
    Map<EnvironmentAlertHandler, AlertEvent> handlersMap = Maps.newHashMap();
    handlersMap.put( environmentAlertHandler, alertEvent );
    doReturn( handlersMap ).when( environmentAlertHandlers ).getAllHandlers();
    AlertHandler alertHandler = mock( AlertHandler.class );
    doReturn( AlertValue.class ).when( alertHandler ).getSupportedAlertValue();
    doReturn( alertHandler ).when( environmentAlertHandlers ).getHandler( environmentAlertHandler );
    AlertValue alertValue = mock( AlertValue.class );
    Alert alert = mock( Alert.class );
    doReturn( alert ).when( alertEvent ).getResource();
    doReturn( alertValue ).when( alert ).getAlertValue( AlertValue.class );
    environmentManager.handleAlertPack( alertEvent, environmentAlertHandlers );
    verify( alertHandler ).postProcess( environment, alertValue );
}