TraceCompletionDeriver extends AbstractProcessor<TraceCompletionInformation, CompletionTime> { @Override public CompletionTime processOneToOne(String tenantId, TraceCompletionInformation item) throws RetryAttemptException { if (item.getCommunications().isEmpty()) { if (log.isLoggable(Level.FINEST)) { log.finest("CompletionTimeDeriver ret=" + item.getCompletionTime()); } return item.getCompletionTime(); } return null; } TraceCompletionDeriver(); @Override CompletionTime processOneToOne(String tenantId, TraceCompletionInformation item);  }
@Test public void testProcessSingleWithCommunications() { TraceCompletionInformation ci = new TraceCompletionInformation(); ci.getCommunications().add(new TraceCompletionInformation.Communication()); TraceCompletionDeriver deriver = new TraceCompletionDeriver(); CompletionTime result = null; try { result = deriver.processOneToOne(null, ci); } catch (Exception e) { fail("Failed: " + e); } assertNull(result); }
@Test public void testProcessSingleWithNoCommunications() { TraceCompletionInformation ci = new TraceCompletionInformation(); CompletionTime ct = new CompletionTime(); ct.setId("ctid"); ci.setCompletionTime(ct); TraceCompletionDeriver deriver = new TraceCompletionDeriver(); CompletionTime result = null; try { result = deriver.processOneToOne(null, ci); } catch (Exception e) { fail("Failed: " + e); } assertNotNull(result); assertEquals(ct.getId(), result.getId()); }