JobControlFinderImpl implements JobControlFinder { @Override public BatchJobData resolveBatchJobData(String jobSequenceId) { BatchJobManagementParam batchJobManagementParam = new BatchJobManagementParam(); batchJobManagementParam.setJobSequenceId(jobSequenceId); BatchJobData batchJobData = systemDao.selectJob( batchJobManagementParam); if (batchJobData.getJobAppCd() != null) { batchJobData.setJobAppCd(batchJobData.getJobAppCd().trim()); } return batchJobData; } JobControlFinderImpl(SystemDao systemDao); @Override BatchJobListResult resolveBatchJobResult(String[] args); @Override BatchJobData resolveBatchJobData(String jobSequenceId);  }
@Test public void testResolveBatchJobData01() { when(((JobControlFinderImpl) jobControlFinder).systemDao .selectJob(any(BatchJobManagementParam.class))).thenReturn( new BatchJobData() { { setJobSequenceId("0000000001"); } }); BatchJobData batchJobData = jobControlFinder.resolveBatchJobData( "0000000001"); assertEquals("0000000001", batchJobData.getJobSequenceId()); }
@Test public void testResolveBatchJobData02() { when(((JobControlFinderImpl) jobControlFinder).systemDao .selectJob(any(BatchJobManagementParam.class))).thenReturn( new BatchJobData() { { setJobSequenceId("0000000001"); setJobAppCd("0000000001 "); } }); BatchJobData batchJobData = jobControlFinder.resolveBatchJobData( "0000000001"); assertEquals("0000000001", batchJobData.getJobAppCd()); }
@Test public void testResolveBatchJobData03() { when(((JobControlFinderImpl) jobControlFinder).systemDao .selectJob(any(BatchJobManagementParam.class))).thenReturn( new BatchJobData() { }); BatchJobData batchJobData = jobControlFinder.resolveBatchJobData( "0000000001"); assertNull(batchJobData.getJobSequenceId()); }