Author: jlmonteiro Date: Mon Sep 14 09:15:11 2009 New Revision: 814538 URL: http://svn.apache.org/viewvc?rev=814538&view=rev Log: itests to check @ApplicationException are well discovered. http://www.nabble.com/Application-exception-handling-problem-td19673820.html#a19673820
Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java Modified: openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java?rev=814538&r1=814537&r2=814538&view=diff ============================================================================== --- openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java (original) +++ openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java Mon Sep 14 09:15:11 2009 @@ -131,4 +131,34 @@ Object obj = businessLocal.remove(); assertNotNull(obj); } + + /** + * Throw an (annotated) application exception and make sure the exception + * reaches the bean nicely. + */ + public void test07_throwAnnotatedApplicationException(){ + try{ + businessLocal.throwAnnotatedApplicationException(); + } catch (org.apache.openejb.test.AnnotatedApplicationException e){ + //Good. This is the correct behaviour + return; + } catch (Throwable e){ + fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); + } + fail("An AnnotatedApplicationException should have been thrown."); + } + + /** + * After an (annotated) application exception we should still be able to + * use our bean + */ + public void test08_invokeAfterAnnotatedApplicationException(){ + try{ + String expected = "Success"; + String actual = businessLocal.businessMethod("sseccuS"); + assertEquals(expected, actual); + } catch (Throwable e){ + fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); + } + } }