package org.jboss.wsf.stack.metro; import java.lang.reflect.InvocationTargetException; import javax.ejb.EJBAccessException; import junit.framework.TestCase; import com.sun.xml.ws.api.server.InstanceResolver; /** * NOTICE: to run the testcase you need to change the visibility of the method * "private void handleException(Exception ex) throws ...." from private to * protected ! Otherwise the method cannot be tested individually * * @author Andreas Wuest * */ public class InvokerEJB3Test extends TestCase { public void testHandleException() { CustomInvokerEJB3 invoker = new CustomInvokerEJB3(null); try { invoker.runHandleException(new EJBAccessException( "authentication failure.")); fail(); } catch (InvocationTargetException e) { fail(); } catch (IllegalAccessException e) { assertTrue("authentication failure.".equals(e.getMessage())); } } private static final class CustomInvokerEJB3 extends InvokerEJB3 { public CustomInvokerEJB3(InstanceResolver resolver) { super(resolver); } public void runHandleException(Exception ex) throws InvocationTargetException, IllegalAccessException { super.handleException(ex); } } }