This is an automated email from the ASF dual-hosted git repository.

csierra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-jax-rs-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 50d7e9d  test avoid a NPE when a method return type is void
50d7e9d is described below

commit 50d7e9dfdc6c0224a86f347f0508a020d23f76e1
Author: Romain Manni-Bucau <rmannibu...@gmail.com>
AuthorDate: Tue Oct 23 16:53:47 2018 +0200

    test avoid a NPE when a method return type is void
---
 jax-rs.itests/src/main/java/test/JaxrsTest.java    |  9 ++++++
 .../src/main/java/test/types/TestVoidResource.java | 34 ++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java 
b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index c834278..679dd6d 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -17,6 +17,7 @@
 
 package test;
 
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -83,6 +84,7 @@ import test.types.TestCxfExtension;
 import test.types.TestFilter;
 import test.types.TestHelper;
 import test.types.TestSSEApplication;
+import test.types.TestVoidResource;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.HttpMethod;
@@ -2350,6 +2352,13 @@ public class JaxrsTest extends TestHelper {
 
     }
 
+    @Test
+    public void testVoidResource() {
+        registerAddon(new TestVoidResource());
+        Response response = 
createDefaultTarget().path("returntype/void").request(TEXT_PLAIN_TYPE).head();
+        assertEquals(Response.Status.NO_CONTENT.getStatusCode(), 
response.getStatus());
+    }
+
     private static Function<RuntimeDTO, FailedApplicationDTO[]>
         FAILED_APPLICATIONS = r -> r.failedApplicationDTOs;
 
diff --git a/jax-rs.itests/src/main/java/test/types/TestVoidResource.java 
b/jax-rs.itests/src/main/java/test/types/TestVoidResource.java
new file mode 100644
index 0000000..9b895c5
--- /dev/null
+++ b/jax-rs.itests/src/main/java/test/types/TestVoidResource.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package test.types;
+
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
+
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path("returntype")
+public class TestVoidResource {
+    @HEAD
+    @Path("void")
+    @Produces(TEXT_PLAIN)
+    public void touch() {
+        // no returned value -> 204
+    }
+}

Reply via email to