@Test public void call() throws Exception { RealtimeService realtimeService = mock(RealtimeService.class); when(SwiftContext.get().getBean(RealtimeService.class)).thenReturn(realtimeService); HistoryService historyService = mock(HistoryService.class); when(SwiftContext.get().getBean(HistoryService.class)).thenReturn(historyService); SourceKey tableKey = mock(SourceKey.class); TruncateJob job = new TruncateJob(tableKey); job.call(); InOrder inOrder = inOrder(realtimeService, historyService); inOrder.verify(realtimeService).truncate(tableKey); inOrder.verify(historyService).truncate(tableKey); inOrder.verifyNoMoreInteractions(); doThrow(Exception.class).when(realtimeService).truncate(ArgumentMatchers.<SourceKey>any()); job.call(); inOrder = inOrder(realtimeService, historyService); inOrder.verify(realtimeService).truncate(tableKey); inOrder.verify(historyService).truncate(tableKey); }
@Override public Void call() { try { SwiftContext.get().getBean(RealtimeService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } try { SwiftContext.get().getBean(HistoryService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } return null; }
TruncateJob extends BaseJob<Void, SourceKey> { @Override public Void call() { try { SwiftContext.get().getBean(RealtimeService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } try { SwiftContext.get().getBean(HistoryService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } return null; } }
TruncateJob extends BaseJob<Void, SourceKey> { @Override public Void call() { try { SwiftContext.get().getBean(RealtimeService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } try { SwiftContext.get().getBean(HistoryService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } return null; } TruncateJob(SourceKey tableKey); }
TruncateJob extends BaseJob<Void, SourceKey> { @Override public Void call() { try { SwiftContext.get().getBean(RealtimeService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } try { SwiftContext.get().getBean(HistoryService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } return null; } TruncateJob(SourceKey tableKey); @Override Void call(); @Override SourceKey serializedTag(); }
TruncateJob extends BaseJob<Void, SourceKey> { @Override public Void call() { try { SwiftContext.get().getBean(RealtimeService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } try { SwiftContext.get().getBean(HistoryService.class).truncate(tableKey); } catch (Exception e) { SwiftLoggers.getLogger().error(e); } return null; } TruncateJob(SourceKey tableKey); @Override Void call(); @Override SourceKey serializedTag();  }