You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/02/19 06:54:04 UTC

[GitHub] deki closed pull request #334: [CXF-7549] test for bug of feature inside a feature

deki closed pull request #334: [CXF-7549] test for bug of feature inside a feature
URL: https://github.com/apache/cxf/pull/334
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBeanTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBeanTest.java
index 73e51c38113..2ac31d6c0de 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBeanTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBeanTest.java
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.ws.rs.core.Feature;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 
@@ -64,6 +65,39 @@ public void testRegisterProviders() {
 
     }
 
+    @Test
+    public void testRegisterInFeature() {
+        JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
+        bean.setAddress("http://localhost:8080/rest");
+        bean.setResourceClasses(BookStore.class);
+        bean.setStart(false);
+        bean.setProvider((Feature)(context) -> {
+            context.register(new RuntimeExceptionMapper());
+
+            return true;
+        });
+
+        bean.create();
+    }
+
+    @Test
+    public void testRegisterFeatureInFeature() {
+        JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
+        bean.setAddress("http://localhost:8080/rest");
+        bean.setStart(false);
+        bean.setResourceClasses(BookStore.class);
+        bean.setProvider((Feature)(context) -> {
+            context.register((Feature) context2-> {
+                context2.register(new RuntimeExceptionMapper());
+
+                return true;
+            });
+
+            return true;
+        });
+
+        bean.create();
+    }
 
     private static class CustomExceptionMapper implements ExceptionMapper<Exception> {
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services