Skip to content

Commit

Permalink
WBRI-275
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2776 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Jun 8, 2009
1 parent d66c199 commit ab9955c
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 1 deletion.
Expand Up @@ -138,4 +138,17 @@ protected ManagerImpl getCurrentManager()
return manager;
}

public boolean isExceptionInHierarchy(Throwable exception, Class<? extends Throwable> expectedException )
{
while (exception != null)
{
if (exception.getClass().equals(expectedException))
{
return true;
}
exception = exception.getCause();
}
return false;
}

}
Expand Up @@ -3,5 +3,5 @@
org.jboss.testharness.standalone=false
org.jboss.testharness.container.extraConfigurationDir=../../webbeans/jboss-as
org.jboss.testharness.container.forceRestart=false
org.jboss.testharness.libraryDirectory=../../webbeans/impl/target/dependency/lib
org.jboss.testharness.libraryDirectory=../../webbeans/tests/target/dependency/lib
org.jboss.testharness.runIntegrationTests=true
@@ -0,0 +1,26 @@
package org.jboss.webbeans.test.unit.implementation.enterprise;

public class BowlerHatException extends RuntimeException
{

public BowlerHatException()
{
super();
}

public BowlerHatException(String message, Throwable cause)
{
super(message, cause);
}

public BowlerHatException(String message)
{
super(message);
}

public BowlerHatException(Throwable cause)
{
super(cause);
}

}
Expand Up @@ -19,6 +19,22 @@ public void testSFSBWithOnlyRemoteInterfacesDeploys()

}

@Test(description="WBRI-275")
public void testSLSBBusinessMethodThrowsRuntimeException()
{
try
{
getCurrentManager().getInstanceByType(Fedora.class).causeRuntimeException();
}
catch (Throwable t)
{
if (isExceptionInHierarchy(t, BowlerHatException.class))
{
return;
}
}
assert false : "Expected a BowlerHatException to be in the cause stack";
}


}
@@ -0,0 +1,12 @@
package org.jboss.webbeans.test.unit.implementation.enterprise;

import javax.ejb.Local;

@Local
public interface Fedora
{

public void causeRuntimeException();


}
@@ -0,0 +1,14 @@
package org.jboss.webbeans.test.unit.implementation.enterprise;

import javax.ejb.Stateless;

@Stateless
public class FedoraImpl implements Fedora
{

public void causeRuntimeException()
{
throw new BowlerHatException();
}

}

0 comments on commit ab9955c

Please sign in to comment.