[seam-commits] Seam SVN: r12874 - in modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces: status and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu May 27 13:56:17 EDT 2010


Author: lincolnthree
Date: 2010-05-27 13:56:16 -0400 (Thu, 27 May 2010)
New Revision: 12874

Modified:
   modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java
   modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java
Log:
Updated messages API and tests

Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java	2010-05-27 17:54:30 UTC (rev 12873)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java	2010-05-27 17:56:16 UTC (rev 12874)
@@ -24,13 +24,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
 import javax.inject.Inject;
 
 import org.jboss.seam.faces.event.PhaseEventBridge;
-import org.jboss.test.faces.mock.context.MockFacesContext;
 import org.jboss.test.faces.mock.lifecycle.MockLifecycle;
+import org.jboss.test.faces.stub.faces.StubFacesContext;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
@@ -41,7 +42,7 @@
    @Inject
    PhaseEventBridge phaseEventBridge;
 
-   protected MockFacesContext facesContext = new MockFacesContext();
+   protected FacesContext facesContext = new StubFacesContext();
    protected final MockLifecycle lifecycle = new MockLifecycle();
 
    static List<PhaseId> ALL_PHASES = new ArrayList<PhaseId>()

Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java	2010-05-27 17:54:30 UTC (rev 12873)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java	2010-05-27 17:56:16 UTC (rev 12874)
@@ -22,6 +22,7 @@
 package org.jboss.seam.faces.status;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import javax.faces.event.PhaseId;
@@ -39,7 +40,7 @@
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
-import org.jboss.test.faces.mock.context.MockFacesContext;
+import org.jboss.test.faces.stub.faces.StubFacesContext;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -60,35 +61,38 @@
    @Inject
    Messages messages;
 
+   String text = "Hey! This is a message";
+
    @Before
    public void before()
    {
-      facesContext = new MockFacesContext();
-      facesContext.getControl().resetToNice();
-      facesContext.getControl().replay();
+      facesContext = new StubFacesContext();
    }
 
    @Test
    public void testMessagesAreTransferredBeforeRenderResponse()
    {
-      messages.add(messages.info("Hey! This is a message"));
+      messages.add(messages.info(text));
       assertEquals(1, messages.getAll().size());
 
       fireBeforePhase(PhaseId.RENDER_RESPONSE);
 
       assertTrue(messages.getAll().isEmpty());
-      // assertNotNull(facesContext.getMessages());
+      assertNotNull(facesContext.getMessages());
+      assertEquals(text, facesContext.getMessages().next().getSummary());
+
    }
 
    @Test
    public void testMessageTargetsTransferredToFacesMessageComponentId()
    {
-      messages.add(messages.info("Hey! This is a message").targets("component"));
+      messages.add(messages.info(text).targets("component"));
       assertEquals(1, messages.getAll().size());
 
       fireBeforePhase(PhaseId.RENDER_RESPONSE);
 
       assertTrue(messages.getAll().isEmpty());
-      // assertNotNull(facesContext.getMessages("component"));
+      assertNotNull(facesContext.getMessages("component"));
+      assertEquals(text, facesContext.getMessages("component").next().getSummary());
    }
 }



More information about the seam-commits mailing list