Author: nickarls
Date: 2008-10-28 07:02:00 -0400 (Tue, 28 Oct 2008)
New Revision: 193
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java
Log:
fill in stubs for context tests
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2008-10-28
10:51:40 UTC (rev 192)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2008-10-28
11:02:00 UTC (rev 193)
@@ -1,9 +1,15 @@
package org.jboss.webbeans.test;
+import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Context;
+
+import org.jboss.webbeans.contexts.NormalContext;
+import org.jboss.webbeans.contexts.RequestContext;
import org.testng.annotations.Test;
@SpecVersion("PDR")
-public class ManagerTest
+public class ManagerTest extends AbstractTest
{
@Test(groups={"manager", "injection"})
@SpecAssertion(section="4.8")
@@ -11,35 +17,42 @@
{
assert false;
}
-
- @Test(groups={"manager"}) @SpecAssertion(section="8.6")
- public void testAddContext()
- {
- assert false;
- }
- @Test(groups={"manager"}) @SpecAssertion(section="8.6")
+ @Test(expectedExceptions={ContextNotActiveException.class},
groups={"manager"}) @SpecAssertion(section="8.6")
public void testGetContextWithNoActiveContextsFails()
{
- assert false;
+ Context requestContext = new RequestContext();
+ ((NormalContext)requestContext).setActive(false);
+ manager.addContext(requestContext);
+ manager.getContext(RequestScoped.class);
}
- @Test(groups={"manager"}) @SpecAssertion(section="8.6")
+ @Test(expectedExceptions={IllegalArgumentException.class},
groups={"manager"}) @SpecAssertion(section="8.6")
public void testGetContextWithTooManyActiveContextsFails()
{
- assert false;
+ Context firstContext = new RequestContext();
+ Context secondContext = new RequestContext();
+ manager.addContext(firstContext);
+ manager.addContext(secondContext);
+ manager.getContext(RequestScoped.class);
+ assert true;
}
- @Test(groups={"manager"}) @SpecAssertion(section="8.6")
+ @Test(expectedExceptions={ContextNotActiveException.class},
groups={"manager"}) @SpecAssertion(section="8.6")
public void testGetContextWithNoRegisteredContextsFails()
{
+ manager.getContext(RequestScoped.class);
assert false;
}
@Test(groups={"manager"}) @SpecAssertion(section="8.6")
public void testGetContextReturnsActiveContext()
{
- assert false;
+ Context requestContext = new RequestContext();
+ manager.addContext(requestContext);
+ Context testContext = manager.getContext(RequestScoped.class);
+ assert testContext == requestContext;
+
}
@Test(groups={"manager", "ejb3"})
@SpecAssertion(section="4.8")
Show replies by date