@Test public void call() throws Exception { mockStatic(SwiftContext.class); when(SwiftContext.get()).thenReturn(mock(BeanFactory.class)); SegmentTransfer transfer = mock(SegmentTransfer.class); whenNew(SegmentTransfer.class).withAnyArguments().thenReturn(transfer); SegmentKey segKey = mock(SegmentKey.class); TransferJob job = new TransferJob(segKey); assertTrue(job.call()); verifyNew(SegmentTransfer.class).withArguments(segKey); verify(transfer).transfer(); doThrow(new RuntimeException()).when(transfer).transfer(); assertFalse(job.call()); }
@Override public Boolean call() { try { new SegmentTransfer(transferSegKey).transfer(); return true; } catch (Exception e) { SwiftLoggers.getLogger().error(e); return false; } }
TransferJob extends BaseJob<Boolean, SegmentKey> { @Override public Boolean call() { try { new SegmentTransfer(transferSegKey).transfer(); return true; } catch (Exception e) { SwiftLoggers.getLogger().error(e); return false; } } }
TransferJob extends BaseJob<Boolean, SegmentKey> { @Override public Boolean call() { try { new SegmentTransfer(transferSegKey).transfer(); return true; } catch (Exception e) { SwiftLoggers.getLogger().error(e); return false; } } TransferJob(SegmentKey transferSegKey); }
TransferJob extends BaseJob<Boolean, SegmentKey> { @Override public Boolean call() { try { new SegmentTransfer(transferSegKey).transfer(); return true; } catch (Exception e) { SwiftLoggers.getLogger().error(e); return false; } } TransferJob(SegmentKey transferSegKey); @Override Boolean call(); @Override SegmentKey serializedTag(); }
TransferJob extends BaseJob<Boolean, SegmentKey> { @Override public Boolean call() { try { new SegmentTransfer(transferSegKey).transfer(); return true; } catch (Exception e) { SwiftLoggers.getLogger().error(e); return false; } } TransferJob(SegmentKey transferSegKey); @Override Boolean call(); @Override SegmentKey serializedTag();  }