@Test
  public void testAuditorInvocation() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(3);

    when(mockClock.currentTimeMillis()).then((invocation) -> {
      latch.countDown();
      return 990L;
    });

    Properties props = AutoBalancerJUnitTest.getBasicConfig();
    assertThat(latch.getCount()).isEqualTo(3);
    AutoBalancer autoR = new AutoBalancer(null, mockAuditor, mockClock, null);
    autoR.initialize(null, props);

    assertThat(latch.await(1, TimeUnit.MINUTES)).isTrue();
    verify(mockAuditor, atLeast(2)).execute();
    verify(mockAuditor, times(1)).init(any(Properties.class));
  }
UnitTests for AutoBalancer. All collaborators should be mocked.
geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerJUnitTest.java