### Question:
FormatterTool { public String formatInterval( long start, long end ) { long diff = end - start; long interval = diff / 1000L; long hours = interval / 3600L; interval -= hours * 3600; long minutes = interval / 60; interval -= minutes * 60; long seconds = interval; if ( hours > 0 ) { return Long.toString( hours ) + "h " + Long.toString( minutes ) + "m " + Long.toString( seconds ) + "s"; } if ( minutes > 0 ) { return Long.toString( minutes ) + "m " + Long.toString( seconds ) + "s"; } return Long.toString( seconds ) + "s"; } FormatterTool( String timestampFormatString ); String formatProjectState( int state ); String formatTrigger( int trigger ); String formatTimestamp( long timestamp ); String formatInterval( long start, long end ); String trim( String str );  }### Answer:
@Test public void testIntervalFormatting() throws Exception { FormatterTool tool = new FormatterTool( null ); assertEquals( "10s", tool.formatInterval( 0, makeTime( 0, 0, 10 ) ) ); assertEquals( "1m 0s", tool.formatInterval( 0, makeTime( 0, 1, 0 ) ) ); assertEquals( "1m 10s", tool.formatInterval( 0, makeTime( 0, 1, 10 ) ) ); assertEquals( "1h 0m 0s", tool.formatInterval( 0, makeTime( 1, 0, 0 ) ) ); assertEquals( "1h 10m 0s", tool.formatInterval( 0, makeTime( 1, 10, 0 ) ) ); assertEquals( "1h 1m 10s", tool.formatInterval( 0, makeTime( 1, 1, 10 ) ) ); assertEquals( "8s", tool.formatInterval( 1112561981137L, 1112561990023L ) ); }