### Question:
AcmComplaintFolderListener implements ApplicationListener<ComplaintCreatedEvent> { @Override public void onApplicationEvent(ComplaintCreatedEvent complaintCreatedEvent) { AlfrescoRmaConfig rmaConfig = alfrescoRecordsService.getRmaConfig(); boolean proceed = rmaConfig.getIntegrationEnabled() && rmaConfig.getCreateRecordFolderOnComplaintCreate(); if (!proceed) { return; } if (!complaintCreatedEvent.isSucceeded()) { log.trace("Returning - complaint creation was not successful"); return; } try { Folder categoryFolder = getAlfrescoRecordsService().findFolder(ComplaintConstants.OBJECT_TYPE); getAlfrescoRecordsService().createOrFindRecordFolder(complaintCreatedEvent.getComplaintNumber(), categoryFolder); } catch (AlfrescoServiceException e) { log.error("Could not create record folder for complaint: {}", e.getMessage(), e); } }  @Override void onApplicationEvent(ComplaintCreatedEvent complaintCreatedEvent); AlfrescoRecordsService getAlfrescoRecordsService(); void setAlfrescoRecordsService(AlfrescoRecordsService alfrescoRecordsService);  }### Answer:
@Test public void doNotProceed_shouldNotCreateRecordFolder() { rmaConfig.setCreateRecordFolderOnComplaintCreate(false); expect(mockService.getRmaConfig()).andReturn(rmaConfig); ComplaintCreatedEvent event = new ComplaintCreatedEvent(new Complaint()); replayAll(); unit.onApplicationEvent(event); verifyAll(); }
@Test public void complaintCreatedEvent_shouldCreateRecordFolder() throws Exception { Complaint complaint = new Complaint(); complaint.setComplaintNumber("complaintNumber"); rmaConfig.setCreateRecordFolderOnComplaintCreate(true); expect(mockService.getRmaConfig()).andReturn(rmaConfig); expect(mockService.findFolder(ComplaintConstants.OBJECT_TYPE)).andReturn(null); expect(mockService.createOrFindRecordFolder(complaint.getComplaintNumber(), null)).andReturn(null); ComplaintCreatedEvent event = new ComplaintCreatedEvent(new Complaint()); event.setSucceeded(true); event.setComplaintNumber(complaint.getComplaintNumber()); replayAll(); unit.onApplicationEvent(event); verifyAll(); }