You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2004/12/19 04:23:00 UTC

cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang/time DurationFormatUtilsTest.java

bayard      2004/12/18 19:23:00

  Modified:    lang/src/test/org/apache/commons/lang/time
                        DurationFormatUtilsTest.java
  Log:
  few more tests to get 100% coverage for Token
  
  Revision  Changes    Path
  1.15      +12 -0     jakarta-commons/lang/src/test/org/apache/commons/lang/time/DurationFormatUtilsTest.java
  
  Index: DurationFormatUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/DurationFormatUtilsTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DurationFormatUtilsTest.java	15 Oct 2004 23:11:31 -0000	1.14
  +++ DurationFormatUtilsTest.java	19 Dec 2004 03:23:00 -0000	1.15
  @@ -318,6 +318,18 @@
             }, 
             DurationFormatUtils.lexx(DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN)
           );
  +
  +        // test failures in equals
  +        DurationFormatUtils.Token token = new DurationFormatUtils.Token( DurationFormatUtils.y, 4 );
  +        assertFalse( "Token equal to non-Token class. ", token.equals(new Object()) );
  +        assertFalse( "Token equal to Token with wrong value class. ", token.equals(
  +            new DurationFormatUtils.Token( new Object() )
  +        ) );
  +        assertFalse( "Token equal to Token with different count. ", token.equals(
  +            new DurationFormatUtils.Token( new Object(), 1 )
  +        ) );
  +        DurationFormatUtils.Token numToken = new DurationFormatUtils.Token( new Integer(1), 4 );
  +        assertTrue( "Token with Number value not equal to itself. ", numToken.equals( numToken ) );
       }
       private void assertArrayEquals(DurationFormatUtils.Token[] obj1, DurationFormatUtils.Token[] obj2) {
           assertEquals( "Arrays are unequal length. ", obj1.length, obj2.length );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org