Author: dion
Date: Mon Nov 21 05:22:27 2005
New Revision: 345902

URL: http://svn.apache.org/viewcvs?rev=345902&view=rev
Log:
Added various assert protected methods to AssertTagSupport

Modified:
    
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileContainsTag.java
    
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java
    
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileNotFoundTag.java
    
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertTagSupport.java
    jakarta/commons/proper/jelly/trunk/jelly-tags/junit/xdocs/changes.xml

Modified: 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileContainsTag.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileContainsTag.java?rev=345902&r1=345901&r2=345902&view=diff
==============================================================================
--- 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileContainsTag.java
 (original)
+++ 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileContainsTag.java
 Mon Nov 21 05:22:27 2005
@@ -79,10 +79,7 @@
                         }
                     }
                     br.close();
-                    if (!found)
-                    {
-                        fail(message);
-                    }
+                    assertTrue(message, found);
                 }
                 catch (IOException fnfe)
                 {

Modified: 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java?rev=345902&r1=345901&r2=345902&view=diff
==============================================================================
--- 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java
 (original)
+++ 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java
 Mon Nov 21 05:22:27 2005
@@ -53,10 +53,7 @@
         }
         else
         {
-            if (!file.exists())
-            {
-                fail(message);
-            }
+            assertTrue(message, file.exists());
         }
        }
     

Modified: 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileNotFoundTag.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileNotFoundTag.java?rev=345902&r1=345901&r2=345902&view=diff
==============================================================================
--- 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileNotFoundTag.java
 (original)
+++ 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileNotFoundTag.java
 Mon Nov 21 05:22:27 2005
@@ -53,10 +53,7 @@
         }
         else
         {
-            if (file.exists())
-            {
-                fail(message);
-            }
+            assertFalse(message, file.exists());
         }
     }
     

Modified: 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertTagSupport.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertTagSupport.java?rev=345902&r1=345901&r2=345902&view=diff
==============================================================================
--- 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertTagSupport.java
 (original)
+++ 
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertTagSupport.java
 Mon Nov 21 05:22:27 2005
@@ -117,4 +117,243 @@
     {
         assertFalse(DEFAULT_MESSAGE, actual);
     }
+    
+    /**
+     * Fail if !expected.equals(actual). If expected is null, actual must be.
+     * @param message failure message.
+     * @param expected expected value.
+     * @param actual actual value to compare against expected.
+     * @throws JellyAssertionFailedError to signify failure
+     */
+    protected void assertEquals(String message, Object expected, Object actual)
+        throws JellyAssertionFailedError
+    {
+        if (expected == null)
+        {
+            assertTrue(message, actual == null);
+        }
+        else
+        {
+            assertTrue(message, expected.equals(actual));
+        }
+    }
+
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(Object expected, Object actual)
+    throws JellyAssertionFailedError
+    {
+        assertEquals(DEFAULT_MESSAGE, expected, actual);
+    }
+    
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, boolean expected, boolean 
actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(boolean expected, boolean actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, byte expected, byte actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(byte expected, byte actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, char expected, char actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(char expected, char actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, double expected, double actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(double expected, double actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, float expected, float actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(float expected, float actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, int expected, int actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(int expected, int actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, long expected, long actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(long expected, long actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+    /**
+     * @see #assertEquals(String, Object, Object)
+     */
+    protected void assertEquals(String message, short expected, short actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertEquals(Object, Object)
+     */
+    protected void assertEquals(short expected, short actual)
+    throws JellyAssertionFailedError
+    {
+        assertTrue(DEFAULT_MESSAGE, expected == actual);
+    }
+
+    /**
+     * Fail if actual is not null
+     * @param message failure message
+     * @param actual value to check
+     * @throws JellyAssertionFailedError to signify failure
+     */
+    protected void assertNull(String message, Object actual)
+    {
+        assertTrue(message, actual == null);
+    }
+    /**
+     * @see assertNull(String, Object)
+     */
+    protected void assertNull(Object actual)
+    {
+        assertNull(DEFAULT_MESSAGE, actual);
+    }
+
+    /**
+     * Fail if actual is null
+     * @param message failure message
+     * @param actual value to check
+     * @throws JellyAssertionFailedError to signify failure
+     */
+    protected void assertNotNull(String message, Object actual)
+    {
+        assertTrue(message, actual != null);
+    }
+    /**
+     * @see assertNotNull(String, Object)
+     */
+    protected void assertNotNull(Object actual)
+    {
+        assertNotNull(DEFAULT_MESSAGE, actual);
+    }
+
+    /**
+     * Fail if expected != actual. If expected is null, actual must not be.
+     * @param message failure message.
+     * @param expected expected value.
+     * @param actual actual value to compare against expected.
+     * @throws JellyAssertionFailedError to signify failure
+     */
+    protected void assertSame(String message, Object expected, Object actual)
+        throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected == actual);
+    }
+    /**
+     * @see #assertSame(String, Object, Object)
+     */
+    protected void assertSame(Object expected, Object actual)
+    throws JellyAssertionFailedError
+    
+    {
+        assertSame(DEFAULT_MESSAGE, expected, actual);
+    }
+
+    /**
+     * Fail if expected == actual. If expected is null, actual must be.
+     * @param message failure message.
+     * @param expected expected value.
+     * @param actual actual value to compare against expected.
+     * @throws JellyAssertionFailedError to signify failure
+     */
+    protected void assertNotSame(String message, Object expected, Object 
actual)
+        throws JellyAssertionFailedError
+    {
+        assertTrue(message, expected != actual);
+    }
+    /**
+     * @see #assertNotSame(String, Object, Object)
+     */
+    protected void assertNotSame(Object expected, Object actual)
+    throws JellyAssertionFailedError
+    
+    {
+        assertNotSame(DEFAULT_MESSAGE, expected, actual);
+    }
 }

Modified: jakarta/commons/proper/jelly/trunk/jelly-tags/junit/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/xdocs/changes.xml?rev=345902&r1=345901&r2=345902&view=diff
==============================================================================
--- jakarta/commons/proper/jelly/trunk/jelly-tags/junit/xdocs/changes.xml 
(original)
+++ jakarta/commons/proper/jelly/trunk/jelly-tags/junit/xdocs/changes.xml Mon 
Nov 21 05:22:27 2005
@@ -25,6 +25,7 @@
   </properties>
   <body>
     <release version="1.0.1-SNAPSHOT" date="in SVN">
+      <action dev="dion" type="update">Added various assert protected methods 
to AssertTagSupport</action>
       <action dev="dion" type="add">Added assertFileContains tag</action>
       <action dev="dion" type="add">Added assertFileNotFound tag</action>
       <action dev="dion" type="add">Added assertFileExists tag</action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to