private StreamRegexMonitor setupStreamRegexMonitor(JobModel jobModel, Config jobModelConfig) {
    StreamRegexMonitor streamRegexMonitor = mock(StreamRegexMonitor.class);
    when(this.streamRegexMonitorFactory.build(eq(jobModel), eq(jobModelConfig), any())).thenReturn(
        Optional.of(streamRegexMonitor));
    return streamRegexMonitor;
  }
Set up {@link StreamRegexMonitorFactory} to return a mock {@link StreamRegexMonitor}.
samza-core/src/test/java/org/apache/samza/coordinator/staticresource/TestStaticResourceJobCoordinator.java