KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chaperon > test > SortedCharSetTestCase


1 /*
2  * Copyright (C) Chaperon. All rights reserved.
3  * -------------------------------------------------------------------------
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8
9 package net.sourceforge.chaperon.test;
10
11 import junit.framework.Test;
12 import junit.framework.TestCase;
13 import junit.framework.TestSuite;
14
15 import net.sourceforge.chaperon.common.SortedCharSet;
16
17 public class SortedCharSetTestCase extends TestCase
18 {
19   public SortedCharSetTestCase(String JavaDoc name)
20   {
21     super(name);
22   }
23
24   public void testCharSet()
25   {
26     SortedCharSet set = new SortedCharSet();
27
28     set.addChar('A');
29     set.addChar('Z');
30     set.addChar('%');
31     set.addChar('a');
32     set.addChar('%');
33     set.addChar('z');
34
35     assertEquals("Test count of chars", 5, set.getCharCount());
36
37     assertEquals("Test char", '%', set.getChar(0));
38     assertEquals("Test char", 'A', set.getChar(1));
39     assertEquals("Test char", 'Z', set.getChar(2));
40     assertEquals("Test char", 'a', set.getChar(3));
41     assertEquals("Test char", 'z', set.getChar(4));
42   }
43
44   public static Test suite()
45   {
46     return new TestSuite(SortedCharSetTestCase.class);
47   }
48 }
49
Popular Tags