You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2018/02/01 20:15:43 UTC

svn commit: r1822901 - /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java

Author: struberg
Date: Thu Feb  1 20:15:43 2018
New Revision: 1822901

URL: http://svn.apache.org/viewvc?rev=1822901&view=rev
Log:
improve interceptor meta-information injection tests

Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java?rev=1822901&r1=1822900&r2=1822901&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/event/normal/TransactionalInterceptor.java Thu Feb  1 20:15:43 2018
@@ -18,19 +18,30 @@
  */
 package org.apache.webbeans.test.component.event.normal;
 
+import javax.enterprise.inject.Intercepted;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptor;
 import javax.interceptor.InvocationContext;
 import java.io.Serializable;
 
+import org.junit.Assert;
+
 @Interceptor
 @Transactional
 public class TransactionalInterceptor implements Serializable
 {
 
+    private @Inject @Intercepted Bean<?> interceptedBean;
+    private @Inject Bean<TransactionalInterceptor> bean;
+    private @Inject javax.enterprise.inject.spi.Interceptor <TransactionalInterceptor> interceptor;
+
+
     @AroundInvoke
     public Object caller(InvocationContext context) throws Exception
     {
+        checkInjections();
         try
         {
             ComponentWithObserves2.hasBeenIntercepted = true;
@@ -43,4 +54,12 @@ public class TransactionalInterceptor im
         
         return null;
     }
+
+    private void checkInjections()
+    {
+        Assert.assertNotNull(interceptedBean);
+        Assert.assertNotNull(bean);
+        Assert.assertNotNull(interceptor);
+    }
+
 }