KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > repository > config > test > RepositoryConfigFactoryTest


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.verge.repository.config.test;
8
9
10 import junit.framework.TestCase;
11
12 import com.inversoft.config.ConfigBuilder;
13 import com.inversoft.config.ConfigRegistry;
14 import com.inversoft.verge.repository.config.RepositoryConfigBuilder;
15 import com.inversoft.verge.repository.config.RepositoryConfigFactory;
16 import com.inversoft.verge.repository.config.RepositoryConfigRegistry;
17
18
19 /**
20  * <p>
21  * This class contains the TestCases for the repository
22  * config factory
23  * </p>
24  *
25  * @author Brian Pontarelli
26  * @since 2.0
27  * @version 2.0
28  */

29 public class RepositoryConfigFactoryTest extends TestCase {
30
31     /**
32      * Constructs a new <code>RepositoryConfigFactoryTest</code> TestCase instance
33      */

34     public RepositoryConfigFactoryTest(String JavaDoc name) {
35         super(name);
36     }
37
38
39     /**
40      * One simple test to verify that the factory is caching the values
41      */

42     public void testAll() {
43
44         RepositoryConfigFactory factory = new RepositoryConfigFactory();
45         ConfigBuilder builder = factory.createBuilder();
46
47         assertTrue("Should be a repository builder",
48             builder instanceof RepositoryConfigBuilder);
49         assertSame("Should always return same instance", builder,
50             factory.createBuilder());
51         assertSame("Should be same when calling create method", builder,
52             factory.createBuilder());
53
54         ConfigRegistry registry = factory.createRegistry();
55
56         assertTrue("Should be a repository registry",
57             registry instanceof RepositoryConfigRegistry);
58         assertNotSame("Should not return same instance", registry,
59             factory.createRegistry());
60     }
61 }
62
Popular Tags