1 4 package org.bsf.remoting.util.naming; 5 6 import javax.naming.Context ; 7 8 import junit.framework.TestCase; 9 10 14 public class TestContextFactory extends TestCase{ 15 16 public TestContextFactory(String s) { 17 super(s); 18 } 19 20 public void testCreateContext() throws Exception { 21 22 23 try { 24 PropertiesICFactory.createInitialContext(null); 25 } catch (Exception e) { 26 assertTrue( e instanceof IllegalArgumentException ); 27 } 28 29 try { 30 PropertiesICFactory.createInitialContext(""); 31 } catch (Exception e) { 32 assertTrue(e instanceof IllegalArgumentException ); 33 } 34 35 try { 36 PropertiesICFactory.createInitialContext("toto"); 37 } catch (Exception e) { 38 assertTrue(e instanceof RuntimeException ); 39 System.out.println(e); 40 } 41 42 Context 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 |