@Test
public void testProcessEvents()
    throws HmsException
{

    PowerMockito.mockStatic( MonitoringUtil.class );
    PowerMockito.mockStatic( AgentHealthMonitoringUtil.class );
    List<Event> eventsLst = new ArrayList<Event>();
    Event event = new Event();
    Body body = new Body();
    Map<String, String> data = new HashMap<String, String>();
    data.put( Constants.HMS_INV_FROM_AGG_AVAILABILITY_STATUS, new String( "true" ) );
    body.setData( data );
    event.setBody( body );
    eventsLst.add( event );
    when( MonitoringUtil.getHealthMonitorEventsOOB() ).thenReturn( eventsLst );
    InbandServiceTestImpl inbandSvc = new InbandServiceTestImpl();
    List<ServerComponentEvent> eventLst = inbandSvc.getComponentEventList( null, ServerComponent.CPU );
    when( AgentHealthMonitoringUtil.getCPUUsage() ).thenReturn( eventLst.get( 0 ) );
    eventLst = inbandSvc.getComponentEventList( null, ServerComponent.MEMORY );
    when( AgentHealthMonitoringUtil.getHMSMemoryUsage() ).thenReturn( eventLst.get( 0 ) );
    ServerComponentEvent sensor = new ServerComponentEvent();
    sensor.setComponentId( "HMS_AGENT_THREAD_USAGE" );
    sensor.setUnit( EventUnitType.COUNT );
    sensor.setEventName( NodeEvent.HMS_AGENT_THREAD_COUNT );
    sensor.setValue( 1 );
    when( AgentHealthMonitoringUtil.getThreadCount() ).thenReturn( sensor );
    HealthMonitorEventAggregatorTask task = new HealthMonitorEventAggregatorTask();
    ServerNode serverNode = new ServerNode();
    List<Event> events = task.processEvents( serverNode, ServerComponent.HMS );
    Assert.assertNotNull( events );
    Event eventObj = events.get( events.size() - 1 );
    Map<String, String> map = eventObj.getBody().getData();
    String value = map.get( Constants.HMS_INV_FROM_AGG_AVAILABILITY_STATUS );
    Assert.assertEquals( "true", value );
}