You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by de...@apache.org on 2017/09/07 09:37:55 UTC

[2/2] cxf git commit: [CXF-7473] added more testcases

[CXF-7473] added more testcases


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

Branch: refs/heads/master
Commit: e47f445bacdca72c86b0aa26c152841f0a37f36e
Parents: 49a1c64
Author: Dennis Kieselhorst <de...@apache.org>
Authored: Thu Sep 7 11:37:48 2017 +0200
Committer: Dennis Kieselhorst <de...@apache.org>
Committed: Thu Sep 7 11:37:48 2017 +0200

----------------------------------------------------------------------
 ...rFactoryHierarchicalExceptionMapperTest.java | 26 ++++++++++++++++----
 1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e47f445b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
index 2b66732..db122b7 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryHierarchicalExceptionMapperTest.java
@@ -31,7 +31,6 @@ import org.junit.Test;
 /**
  * Testcase for CXF-7473
  */
-@Ignore("To be fixed in CXF-7473")
 public class ProviderFactoryHierarchicalExceptionMapperTest {
     private ServerProviderFactory pf;
 
@@ -43,12 +42,29 @@ public class ProviderFactoryHierarchicalExceptionMapperTest {
     }
 
     @Test
-    public void testNearestSuperclassMatch() {
+    public void testExceptionMapperInHierarchy() {
+        ExceptionMapper<?> exceptionMapper = pf.createExceptionMapper(IllegalArgumentException.class,
+                new MessageImpl());
+        Assert.assertNotNull(exceptionMapper);
+        Assert.assertEquals("Wrong mapper found for IllegalArgumentException",
+                IllegalArgumentExceptionMapper.class, exceptionMapper.getClass());
+    }
+
+    @Test
+    public void testSimpleExceptionMapperWhenHierarchyPresent() {
+        ExceptionMapper<?> exceptionMapper = pf.createExceptionMapper(IllegalStateException.class,
+                new MessageImpl());
+        Assert.assertNotNull(exceptionMapper);
+        Assert.assertEquals("Wrong mapper found for IllegalStateException",
+                IllegalStateExceptionMapper.class, exceptionMapper.getClass());
+    }
+
+    @Ignore("To be fixed in CXF-7473")
+    @Test
+    public void testNoMatch() {
         ExceptionMapper<?> exceptionMapper = pf.createExceptionMapper(UnmappedRuntimeException.class,
                 new MessageImpl());
-        Assert.assertNotEquals("Wrong mapper found for UnmappedRuntimeException",
-                IllegalArgumentExceptionMapper.class,
-                exceptionMapper.getClass());
+        Assert.assertNull(exceptionMapper);
     }
 
     public abstract class AbstractExceptionMapper<E extends Throwable> implements ExceptionMapper<E> {