@Test
public void testActivateListener() {

    final JobListenerConfiguration jobListenerConfiguration = DomainTestHelper.createJobListenerConfiguration
            ("src/test/", "*.txt", JobListenerType.LOCAL_FOLDER_LISTENER);
    jobListenerConfiguration.setBeanName("testBean");
    jobListenerConfiguration.setListenerStatus(ListenerStatus.ACTIVE);
    final JobConfiguration jobConfiguration = DomainTestHelper.createJobConfiguration(jobListenerConfiguration);
    final ListenerConstructorWrapper listenerConstructorWrapper = new ListenerConstructorWrapper();
    listenerConstructorWrapper.setJobIncrementer(JobIncrementer.DATE);
    listenerConstructorWrapper.setJob(this.job);
    listenerConstructorWrapper.setJobConfiguration(jobConfiguration);
    listenerConstructorWrapper.setJobLauncher(this.jobLauncher);
    listenerConstructorWrapper.setJobParameters(new JobParametersBuilder().toJobParameters());
    final FolderListener folderListener = new FolderListener(listenerConstructorWrapper);
    when(this.applicationContext.getBean(anyString(), any(Class.class))).thenReturn(folderListener);
    when(this.applicationContext.containsBean(anyString())).thenReturn(Boolean.TRUE);
    try {
        this.listenerService.activateListener("testBean", Boolean.FALSE);
    } catch (final Exception e) {
        fail(e.getMessage());
    }
}