[seam-commits] Seam SVN: r15112 - branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Sep 4 10:52:26 EDT 2012
Author: maschmid
Date: 2012-09-04 10:52:25 -0400 (Tue, 04 Sep 2012)
New Revision: 15112
Modified:
branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java
branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java
Log:
JBSEAM-5024 change java asserts to junit asserts so that the behavior doesn't depend on -ea
Modified: branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java 2012-09-04 13:57:47 UTC (rev 15111)
+++ branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/BlogTest.java 2012-09-04 14:52:25 UTC (rev 15112)
@@ -1,9 +1,10 @@
package org.jboss.seam.example.seamspace.test;
+import static org.junit.Assert.*;
+
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OverProtocol;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.mock.AbstractSeamTest.FacesRequest;
import org.jboss.seam.mock.JUnitSeamTest;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
@@ -23,7 +24,7 @@
web.addClasses(BlogTest.class);
return er;
}
-
+
@Test
public void testCreateBlog() throws Exception
{
@@ -36,19 +37,19 @@
setValue("#{identity.username}", "demo");
setValue("#{identity.password}", "demo");
invokeAction("#{identity.login}");
- assert getValue("#{identity.loggedIn}").equals(true);
+ assertTrue((Boolean)getValue("#{identity.loggedIn}"));
}
}.run();
-
+
String cid = new FacesRequest()
{
@Override
protected void invokeApplication() throws Exception
- {
- assert invokeAction("#{blog.createEntry}") == null;
- }
+ {
+ assertNull(invokeAction("#{blog.createEntry}"));
+ }
}.run();
-
+
new FacesRequest("/createBlog.xhtml", cid)
{
@Override
@@ -70,26 +71,26 @@
"Sed vitae nulla eu tellus fringilla sagittis. Nunc convallis, mi at lobortis " +
"rhoncus, neque turpis ullamcorper odio, quis scelerisque est dolor non velit. Integer vulputate.");
}
-
+
@Override
protected void invokeApplication() throws Exception
{
- assert invokeAction("#{blog.saveEntry}") == null;
+ assertNull(invokeAction("#{blog.saveEntry}"));
}
-
+
}.run();
-
+
new FacesRequest()
{
@Override
protected void invokeApplication() throws Exception
{
invokeAction("#{identity.logout}");
- assert getValue("#{identity.loggedIn}").equals(false);
+ assertFalse((Boolean)getValue("#{identity.loggedIn}"));
}
- }.run();
+ }.run();
}
-
+
//@Test
public void testCreateComment() throws Exception
{
@@ -101,10 +102,10 @@
setValue("#{identity.username}", "demo");
setValue("#{identity.password}", "demo");
invokeAction("#{identity.login}");
- assert getValue("#{identity.loggedIn}").equals(true);
+ assertTrue((Boolean)getValue("#{identity.loggedIn}"));
}
- }.run();
-
+ }.run();
+
String cid = new FacesRequest("/comment.xhtml")
{
@Override
@@ -112,13 +113,13 @@
{
setParameter("name", "Mr_Smiley");
setParameter("blogId", "1");
- }
+ }
@Override
protected void renderResponse() throws Exception
{
- assert getValue("#{selectedBlog}") != null;
- assert getValue("#{selectedBlog.blogId}").equals(1);
+ assertNotNull(getValue("#{selectedBlog}"));
+ assertEquals(1, getValue("#{selectedBlog.blogId}"));
}
}.run();
@@ -127,13 +128,13 @@
@Override
protected void invokeApplication() throws Exception
{
- assert invokeAction("#{blog.createComment}") == null;
-
- assert getValue("#{comment}") != null;
- assert getValue("#{comment.blog}") != null;
+ assertNull(invokeAction("#{blog.createComment}"));
+
+ assertNotNull(getValue("#{comment}"));
+ assertNotNull(getValue("#{comment.blog}"));
}
}.run();
-
+
new FacesRequest("/comment.xhtml", cid)
{
@Override
@@ -141,23 +142,23 @@
{
setValue("#{comment.comment}", "I totally disagree with your blog entry!");
}
-
+
@Override
protected void invokeApplication() throws Exception
{
- assert invokeAction("#{blog.saveComment}") == null;
+ assertNull(invokeAction("#{blog.saveComment}"));
}
}.run();
-
+
new FacesRequest()
{
@Override
protected void invokeApplication() throws Exception
{
invokeAction("#{identity.logout}");
- assert getValue("#{identity.loggedIn}").equals(false);
+ assertFalse((Boolean)getValue("#{identity.loggedIn}"));
}
- }.run();
-
+ }.run();
+
}
}
Modified: branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java 2012-09-04 13:57:47 UTC (rev 15111)
+++ branches/community/Seam_2_3/examples-ee6/seamspace/seamspace-tests/src/test/java/org/jboss/seam/example/seamspace/test/RegisterTest.java 2012-09-04 14:52:25 UTC (rev 15112)
@@ -1,12 +1,13 @@
package org.jboss.seam.example.seamspace.test;
+import static org.junit.Assert.*;
+
import java.util.Date;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OverProtocol;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.core.Manager;
-import org.jboss.seam.mock.AbstractSeamTest.FacesRequest;
import org.jboss.seam.mock.JUnitSeamTest;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
@@ -26,19 +27,19 @@
WebArchive web = er.getAsType(WebArchive.class, "seamspace-web.war");
web.addClasses(RegisterTest.class);
return er;
- }
-
+ }
+
@Test
public void testRegister() throws Exception
{
- String cid = new FacesRequest()
- {
+ String cid = new FacesRequest()
+ {
@Override
protected void invokeApplication() throws Exception
{
- assert invokeAction("#{register.start}") == null;
- }
- }.run();
+ assertNull(invokeAction("#{register.start}"));
+ }
+ }.run();
new FacesRequest("/register.xhtml", cid)
{
@@ -53,38 +54,38 @@
setValue("#{register.password}", "secret");
setValue("#{register.confirm}", "secret");
setValue("#{register.gender}", "Male");
- setValue("#{register.member.dob}", new Date(107100000000L));
+ setValue("#{register.member.dob}", new Date(107100000000L));
}
-
+
@Override
protected void invokeApplication() throws Exception
{
- assert invokeAction("#{register.next}") == null;
- }
+ assertNull(invokeAction("#{register.next}"));
+ }
}.run();
-
+
new FacesRequest("/register2.xhtml", cid)
- {
+ {
@Override
protected void invokeApplication() throws Exception
{
- assert invokeAction("#{register.uploadPicture}") == null;
- assert !Manager.instance().isLongRunningConversation();
- }
-
- }.run();
-
+ assertNull(invokeAction("#{register.uploadPicture}"));
+ assertFalse(Manager.instance().isLongRunningConversation());
+ }
+
+ }.run();
+
new FacesRequest()
- {
+ {
@Override
protected void invokeApplication() throws Exception
{
- assert getValue("#{identity.loggedIn}").equals(true);
- assert invokeAction("#{identity.logout}") == null;
- assert getValue("#{identity.loggedIn}").equals(false);
- }
-
- }.run();
+ assertTrue((Boolean)getValue("#{identity.loggedIn}"));
+ assertNull(invokeAction("#{identity.logout}"));
+ assertFalse((Boolean)getValue("#{identity.loggedIn}"));
+ }
+
+ }.run();
}
}
More information about the seam-commits
mailing list