KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > bsf > remoting > util > naming > TestContextFactory


1 /**
2  * @licence.bsf@
3  */

4 package org.bsf.remoting.util.naming;
5
6 import javax.naming.Context JavaDoc;
7
8 import junit.framework.TestCase;
9
10 /**
11  * @author Gaetan Zoritchak
12  * @version@
13  */

14 public class TestContextFactory extends TestCase{
15
16     public TestContextFactory(String JavaDoc s) {
17         super(s);
18     }
19
20     public void testCreateContext() throws Exception JavaDoc {
21
22
23         try {
24             PropertiesICFactory.createInitialContext(null);
25         } catch (Exception JavaDoc e) {
26             assertTrue( e instanceof IllegalArgumentException JavaDoc);
27         }
28
29         try {
30             PropertiesICFactory.createInitialContext("");
31         } catch (Exception JavaDoc e) {
32             assertTrue(e instanceof IllegalArgumentException JavaDoc);
33         }
34
35         try {
36             PropertiesICFactory.createInitialContext("toto");
37         } catch (Exception JavaDoc e) {
38             assertTrue(e instanceof RuntimeException JavaDoc);
39             System.out.println(e);
40         }
41
42         Context JavaDoc context = PropertiesICFactory.createInitialContext(
43                 "org/bsf/remoting/util/naming/jbossDefault.properties");
44
45         assertNotNull(context);
46         System.out.println(context);
47
48
49     }
50 }
Popular Tags