PurgeTimeSpan { public String toString() { StringBuilder sb = new StringBuilder(); if ( days > 0 ) { sb.append( days ); sb.append( '+' ); } sb.append( toString( hours ) ); sb.append( ':' ); sb.append( toString( minutes ) ); if ( seconds > 0 ) { sb.append( ':' ); sb.append( toString( seconds ) ); } return sb.toString(); } PurgeTimeSpan();  PurgeTimeSpan( String s );  PurgeTimeSpan( int days, int hours, int minutes, int seconds ); int getDays(); int getHours(); int getMinutes(); int getSeconds(); void setDays( int days ); void setHours( int hours ); void setMinutes( int minutes ); void setSeconds( int seconds ); String toString();  }
@Test public void testToString() throws Exception { PurgeTimeSpan span1 = new PurgeTimeSpan( 0, 1, 2, 0 ); assertEquals( "01:02", span1.toString() ); PurgeTimeSpan span2 = new PurgeTimeSpan( 1, 2, 3, 0 ); assertEquals( "1+02:03", span2.toString() ); PurgeTimeSpan span3 = new PurgeTimeSpan( 12, 3, 4, 5 ); assertEquals( "12+03:04:05", span3.toString() ); PurgeTimeSpan span4 = new PurgeTimeSpan( 123, 4, 5, 6 ); assertEquals( "123+04:05:06", span4.toString() ); PurgeTimeSpan span5 = new PurgeTimeSpan( 1234, 5, 6, 7 ); assertEquals( "1234+05:06:07", span5.toString() ); PurgeTimeSpan span6 = new PurgeTimeSpan( 12345, 6, 7, 8 ); assertEquals( "12345+06:07:08", span6.toString() ); PurgeTimeSpan span7 = new PurgeTimeSpan( 0, 1, 2, 3 ); assertEquals( "01:02:03", span7.toString() ); }