From de0bedefe19781ad255d1c481b7ed531868f68f1 Mon Sep 17 00:00:00 2001 From: maxcooper Date: Mon, 7 Jul 2003 04:18:49 +0000 Subject: [PATCH] POSTed parameter test now works --- .../test/http/form/PostMethodTest.java | 21 +++++++++------------ web/share/securePage.jsp | 7 ++++++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/test/org/securityfilter/test/http/form/PostMethodTest.java b/src/test/org/securityfilter/test/http/form/PostMethodTest.java index 52ef000..df7b994 100644 --- a/src/test/org/securityfilter/test/http/form/PostMethodTest.java +++ b/src/test/org/securityfilter/test/http/form/PostMethodTest.java @@ -1,7 +1,7 @@ /* - * $Header: /cvsroot/securityfilter/securityfilter/src/test/org/securityfilter/test/http/form/PostMethodTest.java,v 1.1 2003/06/14 14:12:32 maxcooper Exp $ - * $Revision: 1.1 $ - * $Date: 2003/06/14 14:12:32 $ + * $Header: /cvsroot/securityfilter/securityfilter/src/test/org/securityfilter/test/http/form/PostMethodTest.java,v 1.2 2003/07/07 04:18:49 maxcooper Exp $ + * $Revision: 1.2 $ + * $Date: 2003/07/07 04:18:49 $ * * ==================================================================== * The SecurityFilter Software License, Version 1.1 @@ -55,15 +55,15 @@ package org.securityfilter.test.http.form; -import org.securityfilter.test.http.TestBase; -import org.securityfilter.example.Constants; import com.meterware.httpunit.*; +import org.securityfilter.example.Constants; +import org.securityfilter.test.http.TestBase; /** * LogoutTest - tests the logout functionality. * * @author Max Cooper (max@maxcooper.com) - * @version $Revision: 1.1 $ $Date: 2003/06/14 14:12:32 $ + * @version $Revision: 1.2 $ $Date: 2003/07/07 04:18:49 $ */ public class PostMethodTest extends TestBase { private static final String POST_VALUE = "it works!"; @@ -104,12 +104,9 @@ public class PostMethodTest extends TestBase { assertPageTitle(response, Constants.SECURE_TITLE); // make sure the item we submitted is present - HTMLElement postedValue = response.getElementWithID(Constants.SECURE_POSTED_VALUE_ID); + TableCell postedValue = (TableCell) response.getElementWithID(Constants.SECURE_POSTED_VALUE_ID); assertNotNull("POSTed parameter not found in reponse", postedValue); - System.out.println("postedValue.toString() = " + postedValue.toString()); - System.out.println("postedValue.getID() = " + postedValue.getID()); - System.out.println("postedValue.getName() = " + postedValue.getName()); - System.out.println("postedValue.getTitle() = " + postedValue.getTitle()); - System.out.println("postedValue.getClass().getName() = " + postedValue.getClass().getName()); + System.out.println("postedValue.asText() = \"" + postedValue.asText() + "\""); + assertEquals("POSTed parameter did not have the right value", postedValue.asText(), POST_VALUE); } } diff --git a/web/share/securePage.jsp b/web/share/securePage.jsp index 159ca40..6fcc792 100644 --- a/web/share/securePage.jsp +++ b/web/share/securePage.jsp @@ -18,7 +18,12 @@ Welcome <%=request.getRemoteUser()%>, you are viewing a secure page. if (postedValue != null) { %>

You POSTed a value from the Home Page!

-The value you posted was "<%=postedValue%>". +The value you posted was: + + + + +
<%=postedValue%>
<% } %> -- 2.11.0