JobExecutionEventFeService extends CommonFeService { public ContentPageModel<List<JobExecutionEventModel>> getJobExecutionEventModels(final Integer startIndex, final Integer pageSize) { final List<JobExecutionEventInfo> events = this.eventService.getAllJobExecutionEvents(startIndex, pageSize); final Integer totalCount = this.eventService.getJobExecutionEventInfoCount(); final ContentPageModel<List<JobExecutionEventModel>> contentPageModel = new ContentPageModel<>(startIndex, pageSize, totalCount); final List<JobExecutionEventModel> models = new ArrayList<>(); for (final JobExecutionEventInfo event : events) { final JobExecutionEventModel model = new JobExecutionEventModel(); model.setApplicationName(event.getApplicationName()); model.setJobName(event.getJobName()); model.setId(event.getJobExecutionId()); model.setStartTime(event.getStartDate()); model.setEndTime(event.getEndDate()); model.setExitStatus(event.getExitStatus() != null ? event.getExitStatus().getExitCode().toLowerCase() : ""); models.add(model); final String applicationInstanceId = this.getApplicationInstanceIdByName(event.getApplicationName()); model.setApplicationInstanceId(applicationInstanceId); } contentPageModel.setValue(models); return contentPageModel; } JobExecutionEventFeService(final RegistrationBean registrationBean,
                                      final EventService eventService); ContentPageModel<List<JobExecutionEventModel>> getJobExecutionEventModels(final Integer startIndex,
                                                                                     final Integer pageSize);  }
@Test public void testGetJobExecutionEventModels() { final int pageSize = 5; final List<JobExecutionEventInfo> jobExecutionEventInfos = ServiceTestHelper.createJobExecutionEvents(pageSize, "test_application"); when(this.eventService.getAllJobExecutionEvents(0, pageSize)).thenReturn(jobExecutionEventInfos); final ContentPageModel<List<JobExecutionEventModel>> result = this.jobExecutionEventFeService.getJobExecutionEventModels(0, pageSize); BDDAssertions.then(result).isNotNull(); BDDAssertions.then(result.getValue()).isNotNull(); BDDAssertions.then(result.getValue().size()).isEqualTo(pageSize); }