### Question:
TaskExecutionController { @EventListener(priority = Integer.MAX_VALUE) public void request(TaskExecutionRequestEvent event) { LOG.trace("Task execution request received"); usageService.incrementUsageFor(event.getModuleId()); currentModule = event.getModuleId(); executor.execute(() -> executionService.execute(event.getParameters())); LOG.trace("Task execution submitted"); } @Inject  TaskExecutionController(TaskExecutionService executionService, UsageService usageService); @EventListener(priority = Integer.MAX_VALUE) void request(TaskExecutionRequestEvent event); @EventListener void onShutdown(ShutdownEvent event);  }### Answer:
@Test public void request() { String moduleId = "module"; AbstractParameters params = mock(AbstractParameters.class); victim.request(new TaskExecutionRequestEvent(moduleId, params)); verify(usageService).incrementUsageFor(moduleId); verify(executionService, timeout(1000).times(1)).execute(params); }
@Test public void onEventTaskEventBroadcaster() { String moduleId = "module"; AbstractParameters params = mock(AbstractParameters.class); victim.request(new TaskExecutionRequestEvent(moduleId, params)); TaskEventBroadcaster<TaskExecutionStartedEvent> broadcaster = victim.new TaskEventBroadcaster<>(); TaskExecutionStartedEvent event = new TaskExecutionStartedEvent(null); Listener<TaskExecutionStartedEvent> listener = mock(Listener.class); eventStudio().add(TaskExecutionStartedEvent.class, listener); Listener<TaskExecutionStartedEvent> listenerModule = mock(Listener.class); eventStudio().add(TaskExecutionStartedEvent.class, listenerModule, moduleId); broadcaster.onEvent(event); verify(listener, timeout(1000).times(1)).onEvent(event); verify(listenerModule, timeout(1000).times(1)).onEvent(event); }