private void compareEvents(String hostName, String walName,
    List<WALEventTrackerPayload> walEvents, List<String> expectedStates, boolean strict) {
    List<WALEventTrackerPayload> eventsFilteredByWalName = new ArrayList<>();

    // Assert that all the events have the same host name i.e they came from the same RS.
    for (WALEventTrackerPayload event : walEvents) {
      assertEquals(hostName, event.getRsName());
    }

    // Filter the list by walName.
    for (WALEventTrackerPayload event : walEvents) {
      if (walName.equals(event.getWalName())) {
        eventsFilteredByWalName.add(event);
      }
    }

    // Assert that the list of events after filtering by walName should be same as expected states.
    if (strict) {
      assertEquals(expectedStates.size(), eventsFilteredByWalName.size());
    }

    for (WALEventTrackerPayload event : eventsFilteredByWalName) {
      expectedStates.remove(event.getState());
    }
    assertEquals(0, expectedStates.size());
  }
Compare the events from @{@link WALEventTrackerTableAccessor#WAL_EVENT_TRACKER_TABLE_NAME}
@param hostName       hostname
@param walName        walname
@param walEvents      event from table
@param expectedStates expected states for the hostname and wal name
@param strict         whether to check strictly or not. Sometimes we lose the ACTIVE state
                      event for the first wal since it takes some time for hmaster to create
                      the table and by that time RS already creates the first WAL and will try
                      to persist ACTIVE event to waleventtracker table.
hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestWALEventTracker.java