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 cm...@apache.org on 2003/01/01 21:18:35 UTC

cvs commit: jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jsp JspTagLifecycle.java

cmlenz      2003/01/01 12:18:35

  Modified:    sample-servlet/src/unit/j2ee13/org/apache/cactus/unit
                        TestJspTagLifecycle.java
               framework/src/java/j2ee13/org/apache/cactus/extension/jsp
                        JspTagLifecycle.java
  Log:
  - Renamed assertXXX(...) methods to expectXXX(...), which better 
    describes their nature
  
  Revision  Changes    Path
  1.6       +20 -20    jakarta-cactus/sample-servlet/src/unit/j2ee13/org/apache/cactus/unit/TestJspTagLifecycle.java
  
  Index: TestJspTagLifecycle.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/sample-servlet/src/unit/j2ee13/org/apache/cactus/unit/TestJspTagLifecycle.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestJspTagLifecycle.java	1 Dec 2002 14:36:09 -0000	1.5
  +++ TestJspTagLifecycle.java	1 Jan 2003 20:18:35 -0000	1.6
  @@ -222,7 +222,7 @@
           {
               JspTagLifecycle lifecycle =
                   new JspTagLifecycle(pageContext, new OutTag());
  -            lifecycle.assertScopedVariableExposed(null, new Object[] {"value"});
  +            lifecycle.expectScopedVariableExposed(null, new Object[] {"value"});
               fail("Expected NullPointerException");
           }
           catch (NullPointerException npe)
  @@ -242,7 +242,7 @@
           {
               JspTagLifecycle lifecycle =
                   new JspTagLifecycle(pageContext, new OutTag());
  -            lifecycle.assertScopedVariableExposed("name", null);
  +            lifecycle.expectScopedVariableExposed("name", null);
               fail("Expected NullPointerException");
           }
           catch (NullPointerException npe)
  @@ -262,7 +262,7 @@
           {
               JspTagLifecycle lifecycle =
                   new JspTagLifecycle(pageContext, new OutTag());
  -            lifecycle.assertScopedVariableExposed("name", new Object[0]);
  +            lifecycle.expectScopedVariableExposed("name", new Object[0]);
               fail("Expected IllegalArgumentException");
           }
           catch (IllegalArgumentException iae)
  @@ -282,7 +282,7 @@
           {
               JspTagLifecycle lifecycle =
                   new JspTagLifecycle(pageContext, new OutTag());
  -            lifecycle.assertScopedVariableExposed(
  +            lifecycle.expectScopedVariableExposed(
                   "name", new Object[]{"value"}, 0);
               fail("Expected IllegalArgumentException");
           }
  @@ -305,7 +305,7 @@
           OutTag tag = new OutTag();
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue("Value");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -335,7 +335,7 @@
           OutTag tag = new OutTag();
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue("<value/>");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -366,7 +366,7 @@
           tag.setEscapeXml("false");
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue("<value/>");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -397,7 +397,7 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue(null);
           tag.setDefault("Default");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -430,7 +430,7 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue("Value");
           tag.setDefault("Default");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -460,7 +460,7 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue(null);
           lifecycle.addNestedText("Default");
  -        lifecycle.assertBodyEvaluated();
  +        lifecycle.expectBodyEvaluated();
           lifecycle.invoke();
       }
       
  @@ -492,7 +492,7 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setValue("Value");
           lifecycle.addNestedText("Default");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -542,8 +542,8 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setVar("Item");
           tag.setItems("One,Two,Three");
  -        lifecycle.assertBodyEvaluated(3);
  -        lifecycle.assertScopedVariableExposed(
  +        lifecycle.expectBodyEvaluated(3);
  +        lifecycle.expectScopedVariableExposed(
               "Item", new Object[] {"One", "Two", "Three"});
           lifecycle.invoke();
       }
  @@ -564,7 +564,7 @@
           tag.setVarStatus("status");
           tag.setBegin("0");
           tag.setEnd("2");
  -        lifecycle.assertBodyEvaluated(3);
  +        lifecycle.expectBodyEvaluated(3);
           lifecycle.addInterceptor(new JspTagLifecycle.Interceptor()
           {
               public void evalBody(int theIteration, BodyContent theBody)
  @@ -614,7 +614,7 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setTest("true");
           lifecycle.addNestedText("Value");
  -        lifecycle.assertBodyEvaluated();
  +        lifecycle.expectBodyEvaluated();
           lifecycle.invoke();
       }
       
  @@ -646,7 +646,7 @@
           JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
           tag.setTest("false");
           lifecycle.addNestedText("Value");
  -        lifecycle.assertBodySkipped();
  +        lifecycle.expectBodySkipped();
           lifecycle.invoke();
       }
       
  @@ -683,7 +683,7 @@
           JspTagLifecycle whenLifecycle =
               chooseLifecycle.addNestedTag(whenTag);
           whenTag.setTest("true");
  -        whenLifecycle.assertBodyEvaluated();
  +        whenLifecycle.expectBodyEvaluated();
           
           chooseLifecycle.invoke();
       }
  @@ -710,12 +710,12 @@
           JspTagLifecycle whenLifecycle =
               chooseLifecycle.addNestedTag(whenTag);
           whenTag.setTest("false");
  -        whenLifecycle.assertBodySkipped();
  +        whenLifecycle.expectBodySkipped();
           
           OtherwiseTag otherwiseTag = new OtherwiseTag();
           JspTagLifecycle otherwiseLifecycle =
               chooseLifecycle.addNestedTag(otherwiseTag);
  -        otherwiseLifecycle.assertBodyEvaluated();
  +        otherwiseLifecycle.expectBodyEvaluated();
           
           chooseLifecycle.invoke();
       }
  
  
  
  1.9       +29 -29    jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jsp/JspTagLifecycle.java
  
  Index: JspTagLifecycle.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jsp/JspTagLifecycle.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JspTagLifecycle.java	15 Dec 2002 18:14:56 -0000	1.8
  +++ JspTagLifecycle.java	1 Jan 2003 20:18:35 -0000	1.9
  @@ -138,7 +138,7 @@
     IfTag tag = new IfTag();
     JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
     tag.setTest("false");
  -  lifecycle.assertBodySkipped();
  +  lifecycle.expectBodySkipped();
     lifecycle.invoke();</pre>
    * </p>
    * <p>
  @@ -152,8 +152,8 @@
     JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
     tag.setVar("item");
     tag.setItems("One,Two,Three");
  -  lifecycle.assertBodyEvaluated(3);
  -  lifecycle.assertScopedVariableExposed(
  +  lifecycle.expectBodyEvaluated(3);
  +  lifecycle.expectScopedVariableExposed(
         "item", new Object[] {"One", "Two", "Three"});
     lifecycle.invoke();</pre>
    * </p>
  @@ -211,7 +211,7 @@
         JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
         tag.setValue(null);
         lifecycle.addNestedText("Default");
  -      lifecycle.assertBodyEvaluated();
  +      lifecycle.expectBodyEvaluated();
         lifecycle.invoke();
     }
     public void endOutTagDefaultBody(WebResponse theResponse) {
  @@ -234,11 +234,11 @@
     JspTagLifecycle whenLifecycle =
         chooseLifecycle.addNestedTag(whenTag);
     whenTag.setTest("false");
  -  whenLifecycle.assertBodySkipped();
  +  whenLifecycle.expectBodySkipped();
     OtherwiseTag otherwiseTag = new OtherwiseTag();
     JspTagLifecycle otherwiseLifecycle =
         chooseLifecycle.addNestedTag(otherwiseTag);
  -  otherwiseLifecycle.assertBodyEvaluated();
  +  otherwiseLifecycle.expectBodyEvaluated();
     chooseLifecycle.invoke();</pre>
    *   The code above creates a constellation of tags equivalent to the following
    *   JSP fragment:
  @@ -323,7 +323,7 @@
        * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
        * @since Cactus 1.5
        */
  -    private static class AssertBodyEvaluatedInterceptor
  +    private static class ExpectBodyEvaluatedInterceptor
           extends Interceptor
       {
           /**
  @@ -341,7 +341,7 @@
            * 
            * @param theNumIterations The number of iterations expected
            */
  -        public AssertBodyEvaluatedInterceptor(int theNumIterations)
  +        public ExpectBodyEvaluatedInterceptor(int theNumIterations)
           {
               this.expectedNumIterations = theNumIterations;
           }
  @@ -382,7 +382,7 @@
        * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
        * @since Cactus 1.5
        */
  -    private static class AssertBodySkippedInterceptor
  +    private static class ExpectBodySkippedInterceptor
           extends Interceptor
       {
           /**
  @@ -403,7 +403,7 @@
        * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
        * @since Cactus 1.5
        */
  -    private class AssertScopedVariableExposedInterceptor
  +    private class ExpectScopedVariableExposedInterceptor
           extends Interceptor
       {
           /**
  @@ -429,7 +429,7 @@
            *        one item for every iteration step
            * @param theScope The scope to search for the scoped variable
            */
  -        public AssertScopedVariableExposedInterceptor(String theName,
  +        public ExpectScopedVariableExposedInterceptor(String theName,
               Object[] theExpectedValues, int theScope)
           {
               this.name = theName;
  @@ -635,38 +635,38 @@
       }
       
       /**
  -     * Adds the assertion that the tag body must be evaluated once in the course
  -     * of the tags lifecycle.
  +     * Adds the expectation that the tag body must be evaluated once in the 
  +     * course of the tags lifecycle.
        */
  -    public void assertBodyEvaluated()
  +    public void expectBodyEvaluated()
       {
  -        addInterceptor(new AssertBodyEvaluatedInterceptor(1));
  +        addInterceptor(new ExpectBodyEvaluatedInterceptor(1));
       }
       
       /**
  -     * Adds the assertion that the tag body must be evaluated a specific number
  -     * of times in the course of the tags lifecycle.
  +     * Adds the expectation that the tag body must be evaluated a specific
  +     * number of times in the course of the tags lifecycle.
        * 
        * @param theNumIterations The number of times the body is expected to get 
        *        evaluated
        */
  -    public void assertBodyEvaluated(int theNumIterations)
  +    public void expectBodyEvaluated(int theNumIterations)
       {
  -        addInterceptor(new AssertBodyEvaluatedInterceptor(theNumIterations));
  +        addInterceptor(new ExpectBodyEvaluatedInterceptor(theNumIterations));
       }
       
       /**
  -     * Adds the assertion that the tag body must be skipped. Essentially, this
  +     * Adds the expectation that the tag body must be skipped. Essentially, this
        * assertion verifies that the tag returns <code>SKIP_BODY</code> from
        * <code>doStartTag()</code>.
        */
  -    public void assertBodySkipped()
  +    public void expectBodySkipped()
       {
  -        addInterceptor(new AssertBodySkippedInterceptor());
  +        addInterceptor(new ExpectBodySkippedInterceptor());
       }
       
       /**
  -     * Adds a special assertion that verifies that a specific scoped variable
  +     * Adds a special expectation that verifies that a specific scoped variable
        * is exposed in the body of the tag.
        * 
        * @param theName The name of the variable
  @@ -674,15 +674,15 @@
        *        values of the scoped variable, one for each expected iteration
        *        step
        */
  -    public void assertScopedVariableExposed(String theName,
  +    public void expectScopedVariableExposed(String theName,
                                               Object[] theExpectedValues)
       {
  -        assertScopedVariableExposed(theName, theExpectedValues,
  +        expectScopedVariableExposed(theName, theExpectedValues,
               PageContext.PAGE_SCOPE);
       }
       
       /**
  -     * Adds a special assertion that verifies that a specific scoped variable
  +     * Adds a special expectation that verifies that a specific scoped variable
        * is exposed in the body of the tag.
        * 
        * @param theName The name of the variable
  @@ -691,7 +691,7 @@
        *        step
        * @param theScope The scope under which the variable is stored
        */
  -    public void assertScopedVariableExposed(String theName,
  +    public void expectScopedVariableExposed(String theName,
                                               Object[] theExpectedValues,
                                               int theScope)
       {
  @@ -711,7 +711,7 @@
               throw new IllegalArgumentException();
           }
           addInterceptor(
  -            new AssertScopedVariableExposedInterceptor(theName,
  +            new ExpectScopedVariableExposedInterceptor(theName,
                   theExpectedValues, theScope));
       }
       
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>