1   package org.seasar.remoting.rmi.connector;
2   
3   import java.net.MalformedURLException;
4   import java.net.URL;
5   
6   import junit.framework.Test;
7   import junit.framework.TestSuite;
8   
9   import org.seasar.extension.unit.S2TestCase;
10  
11  /***
12   * @author murata
13   */
14  public class RMIConnectorTest extends S2TestCase {
15      private static String PATH = "test.dicon";
16  
17      //変数の自動セット
18      private RMIConnector connector;
19  
20      public void testLookup() throws Exception {
21          connector.setBaseURL(new URL("http://localhost:1099/"));
22          try {
23              connector.lookup();
24              fail();
25          } catch (Exception e) {
26              assertEquals(MalformedURLException.class, e.getClass());
27          }
28      }
29  
30      public void testLookup2() throws Exception {
31          try {
32              connector.lookup();
33              fail();
34          } catch (Exception e) {
35              assertEquals(java.rmi.ConnectException.class, e.getClass());
36          }
37      }
38  
39      protected void setUp() throws Exception {
40          //S2Containerに対するinclude()メソッド
41          include(PATH);
42      }
43  
44      protected void tearDown() throws Exception {
45      }
46  
47      public RMIConnectorTest(String arg0) {
48          super(arg0);
49      }
50  
51      public static Test suite() {
52          return new TestSuite(RMIConnectorTest.class);
53      }
54  
55      public static void main(String[] args) {
56          junit.textui.TestRunner.run(suite());
57      }
58  }