@Test(expected = Exception.class) public void call() throws Exception { CollateService collateService = mock(CollateService.class); SegmentService segmentService = mock(SegmentService.class); when(SwiftContext.get().getBean(CollateService.class)).thenReturn(collateService); when(SwiftContext.get().getBean(SegmentService.class)).thenReturn(segmentService); List segmentIds = mock(List.class); List segKeys = mock(List.class); SourceKey tableKey = mock(SourceKey.class); when(segmentService.getSegmentKeysByIds(tableKey, segmentIds)).thenReturn(segKeys); CollateJob job = new CollateJob(tableKey, segmentIds); assertTrue(job.call().isEmpty()); verify(collateService).appointCollate(tableKey, segKeys); verify(segmentService).getSegmentKeysByIds(tableKey, segmentIds); doThrow(Exception.class).when(collateService).appointCollate(ArgumentMatchers.<SourceKey>any(), ArgumentMatchers.<SegmentKey>anyList()); job.call(); }
@Override public List<SegmentKey> call() throws Exception { CollateService collateService = SwiftContext.get().getBean(CollateService.class); return collateService.appointCollate(tableKey, segmentService.getSegmentKeysByIds(tableKey, segmentIds)); }
CollateJob extends BaseJob<List<SegmentKey>, List<String>> { @Override public List<SegmentKey> call() throws Exception { CollateService collateService = SwiftContext.get().getBean(CollateService.class); return collateService.appointCollate(tableKey, segmentService.getSegmentKeysByIds(tableKey, segmentIds)); } }
CollateJob extends BaseJob<List<SegmentKey>, List<String>> { @Override public List<SegmentKey> call() throws Exception { CollateService collateService = SwiftContext.get().getBean(CollateService.class); return collateService.appointCollate(tableKey, segmentService.getSegmentKeysByIds(tableKey, segmentIds)); } CollateJob(SourceKey tableKey, List<String> segmentIds); }
CollateJob extends BaseJob<List<SegmentKey>, List<String>> { @Override public List<SegmentKey> call() throws Exception { CollateService collateService = SwiftContext.get().getBean(CollateService.class); return collateService.appointCollate(tableKey, segmentService.getSegmentKeysByIds(tableKey, segmentIds)); } CollateJob(SourceKey tableKey, List<String> segmentIds); @Override List<SegmentKey> call(); @Override List<String> serializedTag(); }
CollateJob extends BaseJob<List<SegmentKey>, List<String>> { @Override public List<SegmentKey> call() throws Exception { CollateService collateService = SwiftContext.get().getBean(CollateService.class); return collateService.appointCollate(tableKey, segmentService.getSegmentKeysByIds(tableKey, segmentIds)); } CollateJob(SourceKey tableKey, List<String> segmentIds); @Override List<SegmentKey> call(); @Override List<String> serializedTag();  }