@Test
public void testGetMetricRecords() throws SQLException, IOException {

  Configuration hbaseConf = new Configuration();
  hbaseConf.setStrings(ZOOKEEPER_QUORUM, "quorum");
  Configuration metricsConf = new Configuration();
  PhoenixConnectionProvider connectionProvider = new PhoenixConnectionProvider() {
    @Override
    public HBaseAdmin getHBaseAdmin() throws IOException {
      return null;
    }
    @Override
    public Connection getConnection() throws SQLException {
      return null;
    }
  };
  PhoenixHBaseAccessor accessor = new PhoenixHBaseAccessor(hbaseConf, metricsConf, connectionProvider);
  List<String> metricNames = new LinkedList<>();
  List<String> hostnames = new LinkedList<>();
  Multimap<String, List<Function>> metricFunctions = ArrayListMultimap.create();
  PowerMock.mockStatic(PhoenixTransactSQL.class);
  PreparedStatement preparedStatementMock = EasyMock.createNiceMock(PreparedStatement.class);
  Condition condition = new DefaultCondition(metricNames, hostnames, "appid", "instanceid", 123L, 234L, Precision.SECONDS, 10, true);
  EasyMock.expect(PhoenixTransactSQL.prepareGetMetricsSqlStmt(null, condition)).andReturn(preparedStatementMock).once();
  ResultSet rsMock = EasyMock.createNiceMock(ResultSet.class);
  EasyMock.expect(preparedStatementMock.executeQuery()).andReturn(rsMock);
  PowerMock.replayAll();
  EasyMock.replay(preparedStatementMock, rsMock);
  // Check when startTime < endTime
  TimelineMetrics tml = accessor.getMetricRecords(condition, metricFunctions);
  // Check when startTime > endTime
  Condition condition2 = new DefaultCondition(metricNames, hostnames, "appid", "instanceid", 234L, 123L, Precision.SECONDS, 10, true);
  TimelineMetrics tml2 = accessor.getMetricRecords(condition2, metricFunctions);
  assertEquals(0, tml2.getMetrics().size());
  PowerMock.verifyAll();
  EasyMock.verify(preparedStatementMock, rsMock);
}