@Override
  public CeWorker create(int ordinal) {
    String uuid = uuidFactory.create();
    CeWorkerImpl ceWorker = new CeWorkerImpl(ordinal, uuid, queue, taskProcessorRepository, ceWorkerController, executionListeners);
    ceWorkers = Stream.concat(ceWorkers.stream(), Stream.of(ceWorker)).collect(Collectors.toSet());
    return ceWorker;
  }
@Test
  public void create_returns_CeWorker_with_listeners_passed_to_factory_constructor() throws NoSuchFieldException, IllegalAccessException {
    CeWorker.ExecutionListener executionListener1 = mock(CeWorker.ExecutionListener.class);
    CeWorker.ExecutionListener executionListener2 = mock(CeWorker.ExecutionListener.class);
    CeWorkerFactoryImpl underTest = new CeWorkerFactoryImpl(mock(InternalCeQueue.class),
      mock(CeTaskProcessorRepository.class), UuidFactoryImpl.INSTANCE, mock(CeWorkerController.class),
      new CeWorker.ExecutionListener[] {executionListener1, executionListener2});

    CeWorker ceWorker = underTest.create(randomOrdinal);

    Field f = CeWorkerImpl.class.getDeclaredField("listeners");
    f.setAccessible(true);
    assertThat((List<CeWorker.ExecutionListener>) f.get(ceWorker)).containsExactly(
      executionListener1, executionListener2);
  }