Source:
<code>public void testGetCompletionTimesFragmentCausedBy() throws Exception { String suffix="3cb2"; Trace trace1 = new Trace(); trace1.setId("1_"+suffix); trace1.setStartTime(System.currentTimeMillis()); Consumer c1 = new Consumer(); c1.setUri("uri1"); c1.getProperties().add(new Property("prop1","value1")); trace1.getNodes().add(c1); Component comp1 = new Component(); comp1.setUri("comp1"); c1.getNodes().add(comp1); Trace trace2 = new Trace(); trace2.setId("2_"+suffix); trace2.setStartTime(System.currentTimeMillis()); Consumer c2 = new Consumer(); c2.setUri("uri2"); c2.getProperties().add(new Property("prop1","value1")); c2.getProperties().add(new Property("prop2","value2")); c2.addCausedByCorrelationId(trace1.getId()+":0:0"); trace2.getNodes().add(c2); Component comp2 = new Component(); comp2.setUri("comp2"); c2.getNodes().add(comp2); Trace trace3 = new Trace(); trace3.setId("3_"+suffix); trace3.setStartTime(System.currentTimeMillis()); Consumer c3 = new Consumer(); c3.setUri("uri3"); c3.getProperties().add(new Property("prop3","value3")); c3.addCausedByCorrelationId(trace1.getId()+":0:0"); trace3.getNodes().add(c3); Component comp3 = new Component(); comp3.setUri("comp3"); c3.getNodes().add(comp3); publisher.publish(null, Arrays.asList(trace1, trace2, trace3)); Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 3); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 1, 15, TimeUnit.SECONDS); List<CompletionTime> times = analytics.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); <START> assertEquals(3, times.get(0).getProperties().size()); <END> }</code><technical_language>good test concrete completion time properties size</technical_language>

Target:
public void testGetCompletionTimesFragmentCausedBy() throws Exception { String suffix="3cb2"; long startTime = System.currentTimeMillis(); Trace trace1 = new Trace(); trace1.setId("1_"+suffix); trace1.setStartTime(startTime - 60000); Consumer c1 = new Consumer(); c1.setUri("uri1"); c1.setDuration(TimeUnit.NANOSECONDS.convert(4000, TimeUnit.MILLISECONDS)); c1.getProperties().add(new Property("prop1","value1")); trace1.getNodes().add(c1); Component comp1 = new Component(); comp1.setUri("comp1"); c1.getNodes().add(comp1); Trace trace2 = new Trace(); trace2.setId("2_"+suffix); trace2.setStartTime(startTime - 40000); Consumer c2 = new Consumer(); c2.setUri("uri2"); c2.setDuration(TimeUnit.NANOSECONDS.convert(15000, TimeUnit.MILLISECONDS)); c2.getProperties().add(new Property("prop1","value1")); c2.getProperties().add(new Property("prop2","value2")); c2.addCausedByCorrelationId(trace1.getId()+":0:0"); trace2.getNodes().add(c2); Component comp2 = new Component(); comp2.setUri("comp2"); c2.getNodes().add(comp2); Trace trace3 = new Trace(); trace3.setId("3_"+suffix); trace3.setStartTime(startTime - 30000); Consumer c3 = new Consumer(); c3.setUri("uri3"); c3.setDuration(TimeUnit.NANOSECONDS.convert(2000, TimeUnit.MILLISECONDS)); c3.getProperties().add(new Property("prop3","value3")); c3.addCausedByCorrelationId(trace1.getId()+":0:0"); trace3.getNodes().add(c3); Component comp3 = new Component(); comp3.setUri("comp3"); c3.getNodes().add(comp3); publisher.publish(null, Arrays.asList(trace1, trace2, trace3)); Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 3); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 1, 15, TimeUnit.SECONDS); List<CompletionTime> times = analytics.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals((trace2.getStartTime() - trace1.getStartTime()) + TimeUnit.MILLISECONDS.convert(c2.getDuration(), TimeUnit.NANOSECONDS), times.get(0).getDuration()); assertEquals(3, times.get(0).getProperties().size()); }