@Test
  public void testCoordinatorStream() {

    Map<String, String> userConfigs = new HashMap<>();
    userConfigs.put("systems.coordinatorStreamWriter.samza.factory", "org.apache.samza.coordinator.stream.MockCoordinatorStreamSystemFactory");
    userConfigs.put("app.name", "coordinator-stream-writer-test");
    userConfigs.put("job.coordinator.system", "coordinatorStreamWriter");
    Config generatedConfig = JobPlanner.generateSingleJobConfig(userConfigs);
    coordinatorStreamWriter = new CoordinatorStreamWriter(generatedConfig);
    boolean exceptionHappened = false;

    try {

      //get coordinator system producer
      Field coordinatorProducerField = coordinatorStreamWriter.getClass().getDeclaredField("coordinatorStreamSystemProducer");
      coordinatorProducerField.setAccessible(true);
      assertNotNull(coordinatorProducerField.get(coordinatorStreamWriter));
      CoordinatorStreamSystemProducer coordinatorStreamSystemProducer = (CoordinatorStreamSystemProducer) coordinatorProducerField.get(coordinatorStreamWriter);

      //get mock system producer
      Field systemProducerField = coordinatorStreamSystemProducer.getClass().getDeclaredField("systemProducer");
      systemProducerField.setAccessible(true);
      systemProducer = (MockCoordinatorStreamSystemFactory.MockSystemProducer) systemProducerField.get(coordinatorStreamSystemProducer);

      testStart();
      testSendMessage();
      testStop();


    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
      e.printStackTrace();
      exceptionHappened = true;
    }

    assertFalse(exceptionHappened);


  }
This class is a unit test for the CoordinatorStreamWriter class.
samza-core/src/test/java/org/apache/samza/coordinator/stream/TestCoordinatorStreamWriter.java