### Question:
TraceeJobListener extends JobListenerSupport { @Override public void jobToBeExecuted(JobExecutionContext context) { final TraceeFilterConfiguration configuration = backend.getConfiguration(profile); if (configuration.shouldProcessContext(AsyncProcess)) { @SuppressWarnings("unchecked") final Map<String, String> traceeContext = (Map<String, String>) context.getMergedJobDataMap().get(TraceeConstants.TPIC_HEADER); if (traceeContext != null && !traceeContext.isEmpty()) { final Map<String, String> filteredContext = configuration.filterDeniedParams(traceeContext, AsyncProcess); backend.putAll(filteredContext); } } Utilities.generateInvocationIdIfNecessary(backend); } TraceeJobListener();  TraceeJobListener(final String profile);   TraceeJobListener(final TraceeBackend backend, final String profile); @Override String getName(); @Override void jobToBeExecuted(JobExecutionContext context); @Override void jobExecutionVetoed(JobExecutionContext context); @Override void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException);  }### Answer:
@Test public void generateRequestIdWhenJobStarts() { final JobExecutionContext executionContext = mock(JobExecutionContext.class); when(executionContext.getMergedJobDataMap()).thenReturn(new JobDataMap()); unit.jobToBeExecuted(executionContext); assertThat(backend.copyToMap(), Matchers.hasKey(TraceeConstants.INVOCATION_ID_KEY)); verify(backend).put(eq(TraceeConstants.INVOCATION_ID_KEY), anyString()); }
@Test public void addContextToTraceeBackend() { final Map<String, String> traceeContext = new HashMap<>(); final JobExecutionContext executionContext = mock(JobExecutionContext.class); final JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(TraceeConstants.TPIC_HEADER, traceeContext); when(executionContext.getMergedJobDataMap()).thenReturn(jobDataMap); traceeContext.put("test", "testVal"); unit.jobToBeExecuted(executionContext); assertThat(backend.get("test"), is("testVal")); }