1 package org.jacorb.test.orb; 2 3 import junit.framework.Test; 4 import junit.framework.TestSuite; 5 6 import org.jacorb.test.*; 7 import org.jacorb.test.common.*; 8 9 14 public class ExceptionTest extends ClientServerTestCase 15 { 16 private ExceptionServer server; 17 18 public ExceptionTest(String name, ClientServerSetup setup) 19 { 20 super(name, setup); 21 } 22 23 public void setUp() throws Exception 24 { 25 server = ExceptionServerHelper.narrow( setup.getServerObject() ); 26 } 27 28 public static Test suite() 29 { 30 TestSuite suite = new JacORBTestSuite("Client/server exception tests", 31 ExceptionTest.class); 32 ClientServerSetup setup = 33 new ClientServerSetup(suite, 34 "org.jacorb.test.orb.ExceptionServerImpl"); 35 36 suite.addTest(new ExceptionTest("testRuntimeException", setup)); 37 38 return setup; 39 } 40 41 47 public void testRuntimeException() 48 { 49 try 50 { 51 server.throwRuntimeException("sample message"); 52 fail("should have raised a CORBA SystemException"); 53 } 54 catch (org.omg.CORBA.SystemException ex) 55 { 56 assertEquals("Server-side Exception: java.lang.RuntimeException: sample message", ex.getMessage()); 57 } 58 } 59 } 60 | Popular Tags |