private List<TezSessionState> testSessions() {
    List<TezSessionState> sessions = new ArrayList<>();
    TezSessionState session = mock(TezSessionState.class);
    when(session.getMetrics()).thenReturn(testMetrics());
    IntStream.range(0, NO_OF_SESSIONS).forEach(i -> sessions.add(session));
    return sessions;
  }
This method tests the core metric calculation logic (refreshMetrics)
without involving the actual metric collection process.
ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestTezSessionPoolManagerMetrics.java