LoggingStopwatches { public static LoggingStopwatchBuilder create( Logger log, Class<?> clazz ) { LogTarget logTarget = new DefaultLogTarget( log ); return create( logTarget, clazz ); }  static LoggingStopwatchBuilder create( Logger log, Class<?> clazz ); static LoggingStopwatchBuilder create( LogTarget logTarget, Class<?> clazz ); static LoggingStopwatch create( Logger log, Class<?> clazz, long warnDuration, TimeUnit timeUnit ); static LoggingStopwatch create( LogTarget logTarget, Class<?> clazz, long warnDuration, TimeUnit timeUnit );  }
@Test public void testCreate() throws Exception { MockLogTarget mockLogTarget = new MockLogTarget(); LoggingStopwatch loggingStopwatch = LoggingStopwatches.create( mockLogTarget, getClass(), 100, TimeUnit.MILLISECONDS ); loggingStopwatch.stop( "testCreate" ); assertEquals( "[]", mockLogTarget.messages.toString() ); Thread.sleep( 120 ); loggingStopwatch.stop( "testCreate" ); assertEquals( 1, mockLogTarget.messages.size() ); String first = mockLogTarget.messages.get( 0 ); assertTrue( first.startsWith( "Call to testCreate in com.spinn3r.artemis.log5j.util.LoggingStopwatchesTest took too long (" ) ); }