@Test
  public void testEmptyMetrics(){
    TezSessionPoolManager poolManager = mock(TezSessionPoolManager.class);
    when(poolManager.getSessions()).thenReturn(new ArrayList<>()); // no open sessions
    TezSessionPoolManagerMetrics metrics = new TezSessionPoolManagerMetrics(poolManager);
    metrics.collectMetrics();

    Assert.assertEquals(0.0, metrics.runningTasksCount.value, 0.0001);
    Assert.assertEquals(0.0, metrics.pendingTasksCount.value, 0.0001);
    Assert.assertEquals(0.0, metrics.taskBacklogRatio.value, 0.0001);
  }
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