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

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.6.x-fixes by this push:
     new 7bd2e787a5 only load the lifecycle, bus and event once to make test 
faster (#1563)
7bd2e787a5 is described below

commit 7bd2e787a5a44b8df4a1fc142ef6425de1be49b1
Author: TestBoost <153348110+testbo...@users.noreply.github.com>
AuthorDate: Thu Dec 14 15:25:28 2023 -0600

    only load the lifecycle, bus and event once to make test faster (#1563)
    
    (cherry picked from commit de62361f57677945438d513d01646c6c7de122fa)
---
 .../jaxrs/cdi/unwrapper/ClassUnwrapperTest.java      | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/systests/cdi/cdi-owb/cdi-producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/unwrapper/ClassUnwrapperTest.java
 
b/systests/cdi/cdi-owb/cdi-producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/unwrapper/ClassUnwrapperTest.java
index 882b28f760..a3a55f582b 100644
--- 
a/systests/cdi/cdi-owb/cdi-producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/unwrapper/ClassUnwrapperTest.java
+++ 
b/systests/cdi/cdi-owb/cdi-producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/unwrapper/ClassUnwrapperTest.java
@@ -32,8 +32,8 @@ import 
org.apache.cxf.systests.cdi.base.BookStoreRequestFilter;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.spi.ContainerLifecycle;
 
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
@@ -44,12 +44,12 @@ import static org.mockito.Mockito.mock;
 
 
 public class ClassUnwrapperTest {
-    private Bus bus;
-    private ContainerLifecycle lifecycle;
-    private ServletContextEvent event;
+    private static Bus bus;
+    private static ContainerLifecycle lifecycle;
+    private static ServletContextEvent event;
     
-    @Before
-    public void setUp() {
+    @BeforeClass
+    public static void setUp() {
         event = new ServletContextEvent(mock(ServletContext.class));
         lifecycle = 
WebBeansContext.currentInstance().getService(ContainerLifecycle.class);
         lifecycle.startApplication(event);
@@ -57,15 +57,15 @@ public class ClassUnwrapperTest {
     }
 
     @SuppressWarnings("unchecked")
-    private<T> T getBeanReference(Class<T> clazz) {
+    private static <T> T getBeanReference(Class<T> clazz) {
         final BeanManager beanManager = lifecycle.getBeanManager();
         final Set<Bean<?>> beans = beanManager.getBeans(clazz);
         final Bean<?> bean = beanManager.resolve(beans);
         return (T)beanManager.getReference(bean, clazz, 
beanManager.createCreationalContext(bean));
     }
 
-    @After
-    public void tearDown() {
+    @AfterClass
+    public static void tearDown() {
         lifecycle.stopApplication(event);
     }
     

Reply via email to