ProcessingDetails { @Override public String toString() { StringBuilder sb = new StringBuilder(256); for (Timing type : Timing.values()) { if (sb.length() > 0) { sb.append(" "); } sb.append(type.name().toLowerCase()) .append("Time=").append(get(type)); } return sb.toString(); } ProcessingDetails(TimeUnit timeUnit); long get(Timing type); long get(Timing type, TimeUnit timeUnit); void set(Timing type, long value); void set(Timing type, long value, TimeUnit timeUnit); void add(Timing type, long value, TimeUnit timeUnit); @Override String toString(); static final Logger LOG; }
@Test public void testToString() { ProcessingDetails details = new ProcessingDetails(TimeUnit.MICROSECONDS); details.set(Timing.ENQUEUE, 10); details.set(Timing.QUEUE, 20, TimeUnit.MILLISECONDS); assertEquals("enqueueTime=10 queueTime=20000 handlerTime=0 " + "processingTime=0 lockfreeTime=0 lockwaitTime=0 locksharedTime=0 " + "lockexclusiveTime=0 responseTime=0", details.toString()); }