1   // $Id: DescriptionTest.java,v 1.2 2004/03/27 12:29:30 powerpete Exp $
2   // [JMP, 25.12.2003] Created this file.
3   package com.pnpconsult.zeiterfassung.util;
4   
5   import junit.framework.TestCase;
6   
7   /***
8    * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
9    * @version $Id: DescriptionTest.java,v 1.2 2004/03/27 12:29:30 powerpete Exp $
10   */
11  public class DescriptionTest extends TestCase
12  {
13  
14      public void testCompareTo()
15      {
16          Description d1 =
17              new Description().append(new Integer(1)).append("2").append(null);
18          Description d2 =
19              new Description().append(new Integer(1)).append("2").append(null);
20          assertTrue(d1.compareTo(d2) == 0);
21          
22          Description d4 =
23              new Description().append(new Integer(2)).append("2").append(null);
24          assertTrue(d1.compareTo(d4) < 0);
25          
26          Description d5 =
27              new Description().append(new Integer(-1)).append("2").append(null);
28          assertTrue(d1.compareTo(d5) > 0);
29      }
30  
31      /*
32       * Class to test for String toString()
33       */
34      public void testToString()
35      {
36          assertEquals(
37              "Hello, World!",
38              new Description()
39                  .append("Hello")
40                  .append(", ", null, "World", "!")
41                  .toString());
42      }
43  
44  }