You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/01/01 13:46:24 UTC
cvs commit: jakarta-cactus/sample-servlet/src/sample/share/org/apache/cactus/sample TestSampleTag.java
vmassol 2003/01/01 04:46:24
Modified: sample-servlet/src/sample/share/org/apache/cactus/sample
TestSampleTag.java
Log:
Fixed checkstyle errors
Revision Changes Path
1.4 +28 -7 jakarta-cactus/sample-servlet/src/sample/share/org/apache/cactus/sample/TestSampleTag.java
Index: TestSampleTag.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/sample-servlet/src/sample/share/org/apache/cactus/sample/TestSampleTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestSampleTag.java 30 Aug 2002 23:25:07 -0000 1.3
+++ TestSampleTag.java 1 Jan 2003 12:46:24 -0000 1.4
@@ -70,7 +70,9 @@
*/
public class TestSampleTag extends JspTestCase
{
- //-------------------------------------------------------------------------
+ /**
+ * Our tag instance to unit test
+ */
private SampleTag tag;
/**
@@ -104,6 +106,9 @@
return new TestSuite(TestSampleTag.class);
}
+ /**
+ * @see TestCase#setUp()
+ */
public void setUp()
{
this.tag = new SampleTag();
@@ -116,6 +121,8 @@
* Tests whether doStartTag() will skip the body if the corresponding tag
* attribute is set. Also tests whether an attribute put into page scope
* before the tag executes will be output to the response.
+ *
+ * @exception Exception if the test fails for an unexpected reason
*/
public void testDoStartTag() throws Exception
{
@@ -133,6 +140,8 @@
/**
* Verifies that the output includes the output from doStartTag (a message
* from the tag and the attribute set into page scope).
+ *
+ * @param theResponse the response from the server side.
*/
public void endDoStartTag(WebResponse theResponse)
{
@@ -149,6 +158,8 @@
/**
* Test whether the tag's body will be shown if the corresponding attribute
* is set.
+ *
+ * @exception Exception if the test fails for an unexpected reason
*/
public void testDoStartTagInclude() throws Exception
{
@@ -163,6 +174,8 @@
/**
* The tag prints a message before the body is included, here we check that
* the message shows up.
+ *
+ * @param theResponse the response from the server side.
*/
public void endDoStartTagInclude(WebResponse theResponse)
{
@@ -175,6 +188,8 @@
/**
* Checks if the tag will continue the page correctly if its stopPage
* property is set to false.
+ *
+ * @exception Exception if the test fails for an unexpected reason
*/
public void testDoEndTagContinue() throws Exception
{
@@ -189,6 +204,8 @@
/**
* Checks whether the tag has printed a message indicating that it has a
* parent tag.
+ *
+ * @param theResponse the response from the server side.
*/
public void endDoEndTagContinue(WebResponse theResponse)
{
@@ -200,6 +217,8 @@
/**
* Checks if the tag will signal that page processing should stop if
* stopPage is set to "true"
+ *
+ * @exception Exception if the test fails for an unexpected reason
*/
public void testDoEndTagStop() throws Exception
{
@@ -214,20 +233,22 @@
/**
* Checks whether the tag has printed a message indicating that it has a
* parent tag. (In this case it should not.)
+ *
+ * @param theResponse the response from the server side.
*/
public void endDoEndTagStop(WebResponse theResponse)
{
- String target = theResponse.getText();
- boolean containsMessage = target.indexOf("This tag has a parent. <BR>") > 0;
-
- assertTrue(!containsMessage);
+ assertContains(theResponse, "This tag has a parent. <BR>");
}
//--------------------------------------------------------------------------
/**
* Convenience function that asserts that a substring can be found in a
- * target String.
+ * the returned HTTP response body.
+ *
+ * @param theResponse the response from the server side.
+ * @param theSubstring the substring to look for
*/
public void assertContains(WebResponse theResponse, String theSubstring)
{
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: cvs commit: jakarta-cactus/sample-servlet/src/sample/share/org/apache/cactus/sample TestSampleTag.java
Posted by Vincent Massol <vm...@octo.com>.
Oops. Thanks Chris. I'll fix that now.
> -----Original Message-----
> From: Christopher Lenz [mailto:cmlenz@gmx.de]
> Sent: 01 January 2003 17:36
> To: Cactus Developers List
> Subject: Re: cvs commit: jakarta-cactus/sample-
> servlet/src/sample/share/org/apache/cactus/sample TestSampleTag.java
>
> Vincent,
>
> vmassol@apache.org wrote:
> > vmassol 2003/01/01 04:46:24
> >
> > Modified:
sample-servlet/src/sample/share/org/apache/cactus/sample
> > TestSampleTag.java
> > Log:
> > Fixed checkstyle errors
> [SNIP]
> > @@ -214,20 +233,22 @@
> > /**
> > * Checks whether the tag has printed a message indicating
that
> it has a
> > * parent tag. (In this case it should not.)
> > + *
> > + * @param theResponse the response from the server side.
> > */
> > public void endDoEndTagStop(WebResponse theResponse)
> > {
> > - String target = theResponse.getText();
> > - boolean containsMessage = target.indexOf("This tag has a
> parent. <BR>") > 0;
> > -
> > - assertTrue(!containsMessage);
> > + assertContains(theResponse, "This tag has a parent.
<BR>");
> > }
>
> This seems to have inverted the logic, i.e. the previous assertion was
> (containsMessage == false), now we're asserting (containsMessage ==
> true). At least, the test is failing for me now.
>
> --
> Christopher Lenz
> /=/ cmlenz at gmx.de
>
>
> --
> To unsubscribe, e-mail: <mailto:cactus-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-dev-
> help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-cactus/sample-servlet/src/sample/share/org/apache/cactus/sample
TestSampleTag.java
Posted by Christopher Lenz <cm...@gmx.de>.
Vincent,
vmassol@apache.org wrote:
> vmassol 2003/01/01 04:46:24
>
> Modified: sample-servlet/src/sample/share/org/apache/cactus/sample
> TestSampleTag.java
> Log:
> Fixed checkstyle errors
[SNIP]
> @@ -214,20 +233,22 @@
> /**
> * Checks whether the tag has printed a message indicating that it has a
> * parent tag. (In this case it should not.)
> + *
> + * @param theResponse the response from the server side.
> */
> public void endDoEndTagStop(WebResponse theResponse)
> {
> - String target = theResponse.getText();
> - boolean containsMessage = target.indexOf("This tag has a parent. <BR>") > 0;
> -
> - assertTrue(!containsMessage);
> + assertContains(theResponse, "This tag has a parent. <BR>");
> }
This seems to have inverted the logic, i.e. the previous assertion was
(containsMessage == false), now we're asserting (containsMessage ==
true). At least, the test is failing for me now.
--
Christopher Lenz
/=/ cmlenz at gmx.de
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>