KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > util > search > test > SearchMethodTest


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.util.search.test;
8
9
10 import junit.framework.TestCase;
11
12 import com.inversoft.util.search.DefaultSearchMethod;
13 import com.inversoft.util.search.SearchMethod;
14
15
16 public class SearchMethodTest extends TestCase {
17
18     /**
19      * Constructs a new <code>SearchMethodTest</code> instance
20      */

21     public SearchMethodTest(String JavaDoc name) {
22         super(name);
23     }
24
25     /**
26      * Tests that the default search method works as expected
27      */

28     public void testDefault() {
29         String JavaDoc name = "foo.bar.goo";
30         SearchMethod def = new DefaultSearchMethod();
31
32         assertEquals("foo.bar.goo", name);
33         name = def.nextSearchName(name);
34         assertEquals("foo.goo", name);
35         name = def.nextSearchName(name);
36         assertEquals("goo", name);
37     }
38
39     /**
40      * Tests that the default search method does nothing if no dot
41      */

42     public void testNoDot() {
43         String JavaDoc name = "foo";
44         SearchMethod def = new DefaultSearchMethod();
45
46         assertNull(def.nextSearchName(name));
47     }
48 }
49
Popular Tags