@Test
  public void testWithEnvironmentEdge() {
    // test for all available zoneID
    for (String zoneID : ZONE_IDS) {
      TimeZone timezone = TimeZone.getTimeZone(zoneID);
      TimeZone.setDefault(timezone);

      // set a time represent hour 11
      long deltaFor11 = TimeZone.getDefault().getRawOffset() - 28800000;
      long timeFor11 = 1597895561000L - deltaFor11;
      EnvironmentEdgeManager.injectEdge(() -> timeFor11);
      CurrentHourProvider.advanceTick();
      int hour11 = CurrentHourProvider.getCurrentHour();
      if (TimeZone.getDefault().inDaylightTime(new Date(timeFor11))) {
        hour11 = CurrentHourProvider.getCurrentHour() - 1;
      }
      assertEquals(11, hour11);

      // set a time represent hour 15
      long deltaFor15 = TimeZone.getDefault().getRawOffset() - 28800000;
      long timeFor15 = 1597907081000L - deltaFor15;
      EnvironmentEdgeManager.injectEdge(() -> timeFor15);
      CurrentHourProvider.advanceTick();
      int hour15 = CurrentHourProvider.getCurrentHour();
      if (TimeZone.getDefault().inDaylightTime(new Date(timeFor15))) {
        hour15 = CurrentHourProvider.getCurrentHour() - 1;
      }
      assertEquals(15, hour15);
    }
  }
In timezone GMT+08:00, the unix time of 2020-08-20 11:52:41 is 1597895561000 and the unix time
of 2020-08-20 15:04:00 is 1597907081000, by calculating the delta time to get expected time in
current timezone, then we can get special hour no matter which timezone it runs.
<p/>
In addition, we should consider the Daylight Saving Time. If in DaylightTime, we need reduce
one hour.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestCurrentHourProvider.java