@Before
  public void setup() {
    MockitoAnnotations.initMocks(this);
    this.schedulerFixedRateExecutionLatch = new CountDownLatch(1);
    this.scheduler = buildScheduledExecutorService(this.schedulerFixedRateExecutionLatch);
    this.containerHeartbeatMonitor = buildContainerHeartbeatMonitor(false);
  }
Use this to detect when the scheduler has finished executing the fixed-rate task.
samza-core/src/test/java/org/apache/samza/container/TestContainerHeartbeatMonitor.java