deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lightguar...@apache.org
Subject [2/2] git commit: Should fix up DELTASPIKE-638
Date Tue, 17 Jun 2014 18:57:57 GMT
Should fix up DELTASPIKE-638

Or at least make things a bit easier to follow.


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/9e665402
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/9e665402
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/9e665402

Branch: refs/heads/master
Commit: 9e665402c55f50f8389a02b8cfd68f053fc27398
Parents: 21cf0a6
Author: Jason Porter <lightguardjp@apache.org>
Authored: Mon Jun 16 14:01:25 2014 -0600
Committer: Jason Porter <lightguardjp@apache.org>
Committed: Tue Jun 17 12:49:37 2014 -0600

----------------------------------------------------------------------
 .../exception/control/flow/RethrowHandler.java  | 13 ++++++++++
 .../exception/control/flow/RethrowTest.java     | 25 ++++++++++++++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9e665402/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
index 88f1947..365c6d3 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowHandler.java
@@ -27,6 +27,9 @@ import org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;
 @ExceptionHandler
 public class RethrowHandler
 {
+
+    static boolean iaeHandlerCalled = false;
+
     public void rethrow(@Handles ExceptionEvent<NullPointerException> event)
     {
         event.throwOriginal();
@@ -37,4 +40,14 @@ public class RethrowHandler
     {
         event.throwOriginal();
     }
+
+    public void handleInbound(@Handles ExceptionEvent<IllegalArgumentException> event)
+    {
+        iaeHandlerCalled = true;
+    }
+
+    public static boolean isIaeHandlerCalled()
+    {
+        return iaeHandlerCalled;
+    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9e665402/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
index 1ba235e..0769505 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/flow/RethrowTest.java
@@ -33,6 +33,8 @@ import org.junit.runner.RunWith;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.inject.Inject;
 
+import static org.junit.Assert.assertFalse;
+
 @RunWith(Arquillian.class)
 public class RethrowTest
 {
@@ -52,12 +54,31 @@ public class RethrowTest
     @Test(expected = NullPointerException.class)
     public void assertOutboundRethrow()
     {
-        bm.fireEvent(new ExceptionToCatchEvent(new NullPointerException()));
+        final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new NullPointerException());
+        try
+        {
+            bm.fireEvent(event);
+        }
+        catch (NullPointerException e)
+        {
+            assertFalse(event.isHandled());
+            throw e;
+        }
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void assertInboundRethrow()
     {
-        bm.fireEvent(new ExceptionToCatchEvent(new IllegalArgumentException()));
+        final ExceptionToCatchEvent event = new ExceptionToCatchEvent(new IllegalArgumentException());
+        try
+        {
+            bm.fireEvent(event);
+        }
+        catch (IllegalArgumentException e)
+        {
+            assertFalse(event.isHandled());
+            assertFalse(RethrowHandler.isIaeHandlerCalled());
+            throw e;
+        }
     }
 }


Mime
View raw message