openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1435748 - /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java
Date Sat, 19 Jan 2013 22:47:46 GMT
Author: struberg
Date: Sat Jan 19 22:47:46 2013
New Revision: 1435748

URL: http://svn.apache.org/viewvc?rev=1435748&view=rev
Log:
OWB-763 migrate test

Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java?rev=1435748&r1=1435747&r2=1435748&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/PostConstructComponentTest.java
Sat Jan 19 22:47:46 2013
@@ -18,65 +18,29 @@
  */
 package org.apache.webbeans.test.unittests.intercept;
 
-import java.util.List;
-
-import javax.enterprise.inject.spi.BeanManager;
 
 import junit.framework.Assert;
 
-import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.test.TestContext;
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.test.component.CheckWithCheckPayment;
 import org.apache.webbeans.test.component.PostConstructComponent;
-import org.junit.Before;
 import org.junit.Test;
 
-public class PostConstructComponentTest extends TestContext
+public class PostConstructComponentTest extends AbstractUnitTest
 {
-    BeanManager container = null;
-
-    public PostConstructComponentTest()
-    {
-        super(PostConstructComponentTest.class.getSimpleName());
-    }
-
-    @Before
-    public void init()
-    {
-        super.init();
-    }
-
     @SuppressWarnings("unchecked")
     @Test
     public void testTypedComponent() throws Throwable
     {
-        clear();
-
-        defineManagedBean(CheckWithCheckPayment.class);
-        defineManagedBean(PostConstructComponent.class);
-        List<AbstractOwbBean<?>> comps = getComponents();
-
-        ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
-        contextFactory.initRequestContext(null);
-
-        Assert.assertEquals(2, comps.size());
+        startContainer(CheckWithCheckPayment.class, PostConstructComponent.class);
 
-        CheckWithCheckPayment object =(CheckWithCheckPayment) getManager().getInstance(comps.get(0));
-        Object object2 = getManager().getInstance(comps.get(1));
-
-        Assert.assertTrue(object instanceof CheckWithCheckPayment);
-        Assert.assertTrue(object2 instanceof PostConstructComponent);
-
-        PostConstructComponent pcc = (PostConstructComponent) object2;
+        CheckWithCheckPayment object = getInstance("checkWithCheckPayment");
+        PostConstructComponent pcc = getInstance(PostConstructComponent.class);
 
         CheckWithCheckPayment chk = (CheckWithCheckPayment) pcc.getP();
 
         Assert.assertNotNull(pcc.getP());
         Assert.assertSame(object.getValue(), chk.getValue());
-
-        contextFactory.destroyRequestContext(null);
     }
 
 }



Mime
View raw message