cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cxf git commit: [CXF-7442] added testcase for ClassCastException
Date Tue, 11 Jul 2017 11:17:13 GMT
Repository: cxf
Updated Branches:
  refs/heads/master af8a95bf9 -> 30ac7940b


[CXF-7442] added testcase for ClassCastException


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

Branch: refs/heads/master
Commit: 30ac7940b4ae32c5da30ac9a40e16556b0c0be0e
Parents: af8a95b
Author: Dennis Kieselhorst <deki@apache.org>
Authored: Tue Jul 11 13:16:51 2017 +0200
Committer: Dennis Kieselhorst <deki@apache.org>
Committed: Tue Jul 11 13:16:51 2017 +0200

----------------------------------------------------------------------
 .../cxf/jaxrs/utils/InjectionUtilsTest.java     | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/30ac7940/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
index d600825..198f4fb 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
@@ -20,10 +20,13 @@ package org.apache.cxf.jaxrs.utils;
 
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -31,11 +34,14 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
+import com.migesok.jaxb.adapter.javatime.LocalDateXmlAdapter;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.jaxrs.model.ParameterType;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
@@ -47,6 +53,7 @@ import org.apache.cxf.message.MessageImpl;
 import org.easymock.EasyMock;
 
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class InjectionUtilsTest extends Assert {
@@ -176,6 +183,15 @@ public class InjectionUtilsTest extends Assert {
         assertEquals(String.class, list.getActualTypeArguments()[0]);
     }
 
+    @Ignore("CXF-7442")
+    @Test
+    public void testJsr310DateExceptionHandling() {
+        Field field = CustomerDetailsWithAdapter.class.getDeclaredFields()[0];
+        Annotation[] paramAnns = field.getDeclaredAnnotations();
+        InjectionUtils.createParameterObject(Collections.singletonList("wrongDate"), LocalDate.class,
+                LocalDate.class, paramAnns, null, false, ParameterType.QUERY, createMessage());
+    }
+
     static class CustomerBean1 {
         private String a;
         private Long b;
@@ -352,4 +368,19 @@ public class InjectionUtilsTest extends Assert {
             return new ArrayList<>();
         }
     }
+
+    public class CustomerDetailsWithAdapter {
+        @NotNull
+        @QueryParam("birthDate")
+        @XmlJavaTypeAdapter(LocalDateXmlAdapter.class)
+        private LocalDate birthDate;
+
+        public LocalDate getBirthDate() {
+            return birthDate;
+        }
+
+        public void setBirthDate(LocalDate birthDate) {
+            this.birthDate = birthDate;
+        }
+    }
 }


Mime
View raw message