Author: jkuhnert
Date: Mon Mar  6 14:00:46 2006
New Revision: 383686

URL: http://svn.apache.org/viewcvs?rev=383686&view=rev
Log:
fixed unit tests for ibm jre

Modified:
    
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/form/validator/TestValidatorFactory.java
    
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java

Modified: 
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/form/validator/TestValidatorFactory.java
URL: 
http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/form/validator/TestValidatorFactory.java?rev=383686&r1=383685&r2=383686&view=diff
==============================================================================
--- 
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/form/validator/TestValidatorFactory.java
 (original)
+++ 
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/form/validator/TestValidatorFactory.java
 Mon Mar  6 14:00:46 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@
  */
 public class TestValidatorFactory extends TapestryTestCase
 {
+
     private Map buildContributions(String name, boolean configurable)
     {
         ValidatorContribution vc = newContribution(configurable, 
ValidatorFixture.class);
@@ -137,8 +138,7 @@
         catch (ApplicationRuntimeException ex)
         {
             assertEquals("Validator 'name' must be configured in order to be 
used. "
-                    + "The value is configured by changing 'name' to 
'name=value'.", ex
-                    .getMessage());
+                    + "The value is configured by changing 'name' to 
'name=value'.", ex.getMessage());
         }
 
         verifyControls();
@@ -158,10 +158,8 @@
         ValidatorFactoryImpl vf = new ValidatorFactoryImpl();
         vf.setValidators(map);
 
-        List result = vf
-                .constructValidatorList(
-                        component,
-                        "required[EMail is required],email,minLength=10[EMail 
must be at least ten characters long]");
+        List result = vf.constructValidatorList(component,
+                "required[EMail is required],email,minLength=10[EMail must be 
at least ten characters long]");
 
         assertEquals(3, result.size());
 
@@ -215,8 +213,8 @@
         }
         catch (ApplicationRuntimeException ex)
         {
-            assertEquals("Validator 'fred' is not configurable, "
-                    + "'fred=biff' should be changed to just 'fred'.", 
ex.getMessage());
+            assertEquals("Validator 'fred' is not configurable, " + 
"'fred=biff' should be changed to just 'fred'.", ex
+                    .getMessage());
         }
 
         verifyControls();
@@ -264,9 +262,8 @@
         }
         catch (ApplicationRuntimeException ex)
         {
-            assertEquals(
-                    "Error initializing validator 'fred' (class 
java.lang.Object): java.lang.Object",
-                    ex.getMessage());
+            assertTrue(ex.getMessage().startsWith(
+                    "Error initializing validator 'fred' (class 
java.lang.Object): java.lang.Object"));
         }
 
         verifyControls();
@@ -299,7 +296,8 @@
         return component;
     }
 
-    public void testBeanReference() throws Exception
+    public void testBeanReference()
+        throws Exception
     {
         Validator validator = newValidator();
         IBeanProvider provider = newBeanProvider("fred", validator);
@@ -360,8 +358,7 @@
         }
         catch (ApplicationRuntimeException ex)
         {
-            assertEquals(
-                    "Bean 'fred' does not implement the 
org.apache.tapestry.form.validator.Validator interface.",
+            assertEquals("Bean 'fred' does not implement the 
org.apache.tapestry.form.validator.Validator interface.",
                     ex.getMessage());
             assertSame(bean, ex.getComponent());
         }

Modified: 
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java
URL: 
http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java?rev=383686&r1=383685&r2=383686&view=diff
==============================================================================
--- 
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java
 (original)
+++ 
jakarta/tapestry/branches/4.0/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java
 Mon Mar  6 14:00:46 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
  */
 public class TestListenerMapSource extends HiveMindTestCase
 {
+
     private IRequestCycle newCycle(Object[] listenerParameters)
     {
         MockControl control = newControl(IRequestCycle.class);
@@ -47,10 +48,9 @@
     {
         Method[] methods = clazz.getMethods();
 
-        for (int i = 0; i < methods.length; i++)
+        for(int i = 0; i < methods.length; i++)
         {
-            if (methods[i].getName().equals(name))
-                return methods[i];
+            if (methods[i].getName().equals(name)) return methods[i];
         }
 
         throw new IllegalArgumentException("No method '" + name + "' in " + 
clazz + ".");
@@ -79,8 +79,7 @@
 
     public void testFoundWithParameters()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello", new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) 
});
         ListenerMethodHolder holder = newHolder();
 
         holder.fred("Hello", 7);
@@ -98,8 +97,7 @@
 
     public void testFoundWithCycleAndParameters()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { new Integer(7) });
         ListenerMethodHolder holder = newHolder();
 
         holder.wilma(cycle, 7);
@@ -116,13 +114,13 @@
     }
 
     /**
-     * No exact match on parameter count, fall through to the no-arguments 
method implementation.
+     * No exact match on parameter count, fall through to the no-arguments
+     * method implementation.
      */
 
     public void testNoParameterMatch()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello", new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) 
});
         ListenerMethodHolder holder = newHolder();
 
         holder.barney();
@@ -140,8 +138,7 @@
 
     public void testFallbackToJustCycle()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello", new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) 
});
 
         ListenerMethodHolder holder = newHolder();
 
@@ -179,13 +176,13 @@
     public void testReturnLink()
     {
         ILink link = newLink("http://foo/bar";);
-        
+
         IRequestCycle cycle = newCycle(null);
-        
+
         cycle.sendRedirect("http://foo/bar";);
-        
+
         ListenerMethodHolder holder = new ListenerMethodHolder(link);
-        
+
         replayControls();
 
         ListenerMapSource source = new ListenerMapSourceImpl();
@@ -194,7 +191,7 @@
 
         map.getListener("returnsLink").actionTriggered(null, cycle);
 
-        verifyControls();    
+        verifyControls();
     }
 
     private ILink newLink(String absoluteURL)
@@ -229,8 +226,7 @@
 
     public void testNoMatch()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello", new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) 
});
 
         replayControls();
 
@@ -258,8 +254,7 @@
 
     public void testMismatchedTypes()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello" });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello" });
 
         replayControls();
 
@@ -276,9 +271,15 @@
         }
         catch (ApplicationRuntimeException ex)
         {
-            assertEquals(
-                    "Failure invoking listener method 'public void 
org.apache.tapestry.listener.ListenerMethodHolder.wrongTypes(java.util.Map)' on 
ListenerMethodHolder: argument type mismatch",
-                    ex.getMessage());
+            assertEquals(IllegalArgumentException.class, 
ex.getRootCause().getClass());
+            assertTrue(ex.getMessage().startsWith(
+                    "Failure invoking listener method 'public void "
+                            + 
"org.apache.tapestry.listener.ListenerMethodHolder."
+                            + "wrongTypes(java.util.Map)' on 
ListenerMethodHolder:"));
+            // TODO: IBM jre doesn't format these messages the same as sun's
+            // jre,
+            // IBM's message has no message string source for the
+            // IllegalArgumentException
             assertSame(holder, ex.getComponent());
         }
 
@@ -287,8 +288,7 @@
 
     public void testInvocationTargetException()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello", new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) 
});
 
         ListenerMethodHolder holder = new ListenerMethodHolder();
 
@@ -321,8 +321,7 @@
 
     public void testInvocationTargetExceptionForApplicationRuntimeException()
     {
-        IRequestCycle cycle = newCycle(new Object[]
-        { "Hello", new Integer(7) });
+        IRequestCycle cycle = newCycle(new Object[] { "Hello", new Integer(7) 
});
 
         ListenerMethodHolder holder = new ListenerMethodHolder();
 
@@ -353,4 +352,4 @@
     {
         return (ListenerMethodHolder) newMock(ListenerMethodHolder.class);
     }
-}
\ No newline at end of file
+}



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

Reply via email to