You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/02/02 01:08:30 UTC
svn commit: r617717 [2/2] - in /tapestry/tapestry5/trunk:
tapestry-core/src/main/java/org/apache/tapestry/
tapestry-core/src/main/java/org/apache/tapestry/corelib/base/
tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/
tapestry-core/src/m...
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java Fri Feb 1 16:07:33 2008
@@ -14,7 +14,6 @@
package org.apache.tapestry.internal.services;
-import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.SetupRender;
import org.apache.tapestry.model.MutableComponentModel;
import org.apache.tapestry.services.ClassTransformation;
@@ -24,8 +23,6 @@
import org.apache.tapestry.test.TapestryTestCase;
import org.testng.annotations.Test;
-import java.lang.reflect.Modifier;
-
/**
* Of course, we're committing the cardinal sin of testing the code that's generated, rather than
* the *behavior* of the generated code. Fortunately, we back all this up with lots and lots of
@@ -72,268 +69,4 @@
verify();
}
-
- @Test
- public void void_method()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature sig = new TransformMethodSignature("aMethod");
-
- train_findMethods(tf, sig);
-
- train_getMethodAnnotation(tf, sig, SetupRender.class, annotation);
-
- train_isRootClass(model, false);
-
- train_addMethod(
- tf,
- TransformConstants.SETUP_RENDER_SIGNATURE,
- "{ super.setupRender($$); if ($2.isAborted()) return; aMethod(); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, false);
-
- worker.transform(tf, model);
-
- verify();
- }
-
- @Test
- public void match_on_method_name()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
-
- TransformMethodSignature sig = new TransformMethodSignature("setupRender");
-
- train_findMethods(tf, sig);
-
- train_isRootClass(model, false);
-
- train_addMethod(
- tf,
- TransformConstants.SETUP_RENDER_SIGNATURE,
- "{ super.setupRender($$); if ($2.isAborted()) return; setupRender(); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, false);
-
- worker.transform(tf, model);
-
- verify();
- }
-
- protected final SetupRender newSetupRender()
- {
- return newMock(SetupRender.class);
- }
-
- @Test
- public void multiple_methods_reverse_order()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature siga = new TransformMethodSignature("aMethod");
- TransformMethodSignature sigb = new TransformMethodSignature("bMethod");
-
- train_findMethods(tf, siga, sigb);
-
- train_getMethodAnnotation(tf, siga, SetupRender.class, annotation);
- train_getMethodAnnotation(tf, sigb, SetupRender.class, annotation);
-
- train_isRootClass(model, false);
-
- train_addMethod(
- tf,
- TransformConstants.SETUP_RENDER_SIGNATURE,
- "{ bMethod(); aMethod(); super.setupRender($$); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, true);
-
- worker.transform(tf, model);
-
- verify();
- }
-
- @Test
- public void multiple_methods_parent_class_reverse_order()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature siga = new TransformMethodSignature("aMethod");
- TransformMethodSignature sigb = new TransformMethodSignature("bMethod");
-
- train_findMethods(tf, siga, sigb);
-
- train_getMethodAnnotation(tf, siga, SetupRender.class, annotation);
- train_getMethodAnnotation(tf, sigb, SetupRender.class, annotation);
-
- train_isRootClass(model, true);
-
- train_addMethod(tf, TransformConstants.SETUP_RENDER_SIGNATURE, "{ bMethod(); aMethod(); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, true);
-
- worker.transform(tf, model);
-
- verify();
-
- }
-
- @Test
- public void method_in_base_class()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature sig = new TransformMethodSignature("aMethod");
-
- train_findMethods(tf, sig);
-
- train_getMethodAnnotation(tf, sig, SetupRender.class, annotation);
-
- train_isRootClass(model, true);
-
- train_addMethod(tf, TransformConstants.SETUP_RENDER_SIGNATURE, "{ aMethod(); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, false);
-
- worker.transform(tf, model);
-
- verify();
-
- }
-
- @Test
- public void method_with_markup_writer_parameter()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature sig = new TransformMethodSignature(Modifier.PUBLIC, "void", "aMethod", new String[]
- {MarkupWriter.class.getName()}, null);
-
- train_findMethods(tf, sig);
-
- train_getMethodAnnotation(tf, sig, SetupRender.class, annotation);
-
- train_isRootClass(model, false);
-
- train_addMethod(
- tf,
- TransformConstants.SETUP_RENDER_SIGNATURE,
- "{ super.setupRender($$); if ($2.isAborted()) return; aMethod($1); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, false);
-
- worker.transform(tf, model);
-
- verify();
-
- }
-
- @Test
- public void nonvoid_method()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature sig = new TransformMethodSignature(Modifier.PROTECTED, "boolean", "aMethod", null,
- null);
-
- train_findMethods(tf, sig);
-
- train_getMethodAnnotation(tf, sig, SetupRender.class, annotation);
- train_getMethodIdentifier(tf, sig, "biff.Baz.aMethod()");
-
- train_isRootClass(model, false);
-
- train_addMethod(
- tf,
- TransformConstants.SETUP_RENDER_SIGNATURE,
- "{",
- "super.setupRender($$);",
- "if ($2.isAborted()) return; ",
- "$2.setSource(this, \"biff.Baz.aMethod()\");",
- "if ($2.storeResult(($w) aMethod())) return;",
- "}");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, false);
-
- worker.transform(tf, model);
-
- verify();
- }
-
- @Test
- public void multiple_methods()
- {
- ClassTransformation tf = mockClassTransformation();
- MutableComponentModel model = mockMutableComponentModel();
- SetupRender annotation = newSetupRender();
-
- TransformMethodSignature siga = new TransformMethodSignature(Modifier.PROTECTED, "boolean", "aMethod", null,
- null);
- TransformMethodSignature sigb = new TransformMethodSignature(Modifier.PUBLIC, "void", "bMethod", new String[]
- {MarkupWriter.class.getName()}, null);
-
- String ida = "aMethod()";
-
- train_findMethods(tf, siga, sigb);
-
- train_getMethodAnnotation(tf, siga, SetupRender.class, annotation);
- train_getMethodIdentifier(tf, siga, ida);
-
- train_getMethodAnnotation(tf, sigb, SetupRender.class, annotation);
-
- train_isRootClass(model, false);
-
- train_addMethod(
- tf,
- TransformConstants.SETUP_RENDER_SIGNATURE,
- "{ super.setupRender($$);",
- "if ($2.isAborted()) return;",
- "$2.setSource(this, \"aMethod()\");",
- "if ($2.storeResult(($w) aMethod())) return;",
- "bMethod($1); }");
-
- replay();
-
- ComponentClassTransformWorker worker = new ComponentLifecycleMethodWorker(
- TransformConstants.SETUP_RENDER_SIGNATURE, SetupRender.class, false);
-
- worker.transform(tf, model);
-
- verify();
- }
-
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java Fri Feb 1 16:07:33 2008
@@ -35,6 +35,7 @@
ComponentResources resources = mockComponentResources();
Translator translator = mockTranslator();
ValidationMessagesSource source = mockValidationMessagesSource();
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
String clientValue = "abracadabra";
@@ -49,7 +50,7 @@
// Pretend that the parser event handler converted it to upper case.
- return handler.handleResult(context[0].toString().toUpperCase(), null, null);
+ return handler.handleResult(context[0].toString().toUpperCase());
}
};
@@ -63,7 +64,7 @@
FieldValidationSupport support = new FieldValidationSupportImpl(source);
- Object actual = support.parseClient(clientValue, resources, translator);
+ Object actual = support.parseClient(clientValue, resources, translator, nullFieldStrategy);
assertEquals(actual, clientValue.toUpperCase());
@@ -71,41 +72,50 @@
}
@Test
- public void to_client_for_null_value_returns_null_and_bypasses_events_and_translator() throws Exception
+ public void parse_client_for_null_value_returns_null_and_bypasses_events_and_translator() throws Exception
{
+ Messages messages = mockMessages();
ComponentResources resources = mockComponentResources();
Translator translator = mockTranslator();
ValidationMessagesSource source = mockValidationMessagesSource();
+ Locale locale = Locale.GERMAN;
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
- replay();
-
-
- FieldValidationSupport support = new FieldValidationSupportImpl(source);
+ String clientValue = "";
- assertNull(support.parseClient(null, resources, translator));
+ train_replaceFromClient(nullFieldStrategy, "");
+ ignoreEvent(resources, FieldValidationSupportImpl.PARSE_CLIENT_EVENT, clientValue);
- verify();
- }
+ train_getLocale(resources, locale);
- @Test
- public void parse_client_for_blank_string_returns_null_and_bypasses_events_and_translator() throws Exception
- {
- ComponentResources resources = mockComponentResources();
- Translator translator = mockTranslator();
- ValidationException ve = new ValidationException("Just didn't feel right.");
- ValidationMessagesSource source = mockValidationMessagesSource();
+ train_getValidationMessages(source, locale, messages);
+ expect(translator.parseClient(clientValue, messages)).andReturn("");
replay();
FieldValidationSupport support = new FieldValidationSupportImpl(source);
- assertNull(support.parseClient("", resources, translator));
+ Object actual = support.parseClient(clientValue, resources, translator, nullFieldStrategy);
+
+ assertEquals(actual, "");
verify();
}
+ private void ignoreEvent(ComponentResources resources, String event, Object... context)
+ {
+ EasyMock.expect(resources.triggerEvent(EasyMock.eq(event),
+ EasyMock.aryEq(context),
+ EasyMock.isA(ComponentEventCallback.class))).andReturn(false);
+ }
+
+ protected final void train_replaceFromClient(NullFieldStrategy nullFieldStrategy, String value)
+ {
+ expect(nullFieldStrategy.replaceFromClient()).andReturn(value).atLeastOnce();
+ }
+
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
@Test
public void parse_client_event_handler_throws_validation_exception() throws Exception
@@ -114,10 +124,10 @@
Translator translator = mockTranslator();
ValidationException ve = new ValidationException("Just didn't feel right.");
ValidationMessagesSource source = mockValidationMessagesSource();
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
String clientValue = "abracadabra";
-
EasyMock.expect(resources.triggerEvent(EasyMock.eq(FieldValidationSupportImpl.PARSE_CLIENT_EVENT),
EasyMock.isA(Object[].class),
EasyMock.isA(ComponentEventCallback.class))).andThrow(
@@ -130,7 +140,7 @@
try
{
- support.parseClient(clientValue, resources, translator);
+ support.parseClient(clientValue, resources, translator, nullFieldStrategy);
unreachable();
}
@@ -151,6 +161,7 @@
Translator translator = mockTranslator();
RuntimeException re = new RuntimeException("Just didn't feel right.");
ValidationMessagesSource source = mockValidationMessagesSource();
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
String clientValue = "abracadabra";
@@ -166,7 +177,7 @@
try
{
- support.parseClient(clientValue, resources, translator);
+ support.parseClient(clientValue, resources, translator, nullFieldStrategy);
unreachable();
}
@@ -187,13 +198,11 @@
Translator translator = mockTranslator();
ValidationMessagesSource source = mockValidationMessagesSource();
Locale locale = Locale.GERMAN;
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
String clientValue = "abracadabra";
-
- EasyMock.expect(resources.triggerEvent(EasyMock.eq(FieldValidationSupportImpl.PARSE_CLIENT_EVENT),
- EasyMock.isA(Object[].class),
- EasyMock.isA(ComponentEventCallback.class))).andReturn(false);
+ ignoreEvent(resources, FieldValidationSupportImpl.PARSE_CLIENT_EVENT, clientValue);
train_getLocale(resources, locale);
@@ -205,7 +214,7 @@
FieldValidationSupport support = new FieldValidationSupportImpl(source);
- Object actual = support.parseClient(clientValue, resources, translator);
+ Object actual = support.parseClient(clientValue, resources, translator, nullFieldStrategy);
assertEquals(actual, "foobar");
@@ -220,6 +229,7 @@
ComponentResources resources = mockComponentResources();
Translator translator = mockTranslator();
ValidationMessagesSource source = mockValidationMessagesSource();
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
String clientValue = "abracadabra";
@@ -233,7 +243,7 @@
FieldValidationSupport support = new FieldValidationSupportImpl(source);
- String actual = support.toClient(value, resources, translator);
+ String actual = support.toClient(value, resources, translator, nullFieldStrategy);
assertEquals(actual, clientValue);
@@ -248,6 +258,7 @@
ComponentResources resources = mockComponentResources();
Translator translator = mockTranslator();
ValidationMessagesSource source = mockValidationMessagesSource();
+ NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();
final String clientValue = "abracadabra";
@@ -259,7 +270,7 @@
Object[] args = EasyMock.getCurrentArguments();
ComponentEventCallback handler = (ComponentEventCallback) args[2];
- return handler.handleResult(clientValue, null, null);
+ return handler.handleResult(clientValue);
}
};
@@ -272,7 +283,7 @@
FieldValidationSupport support = new FieldValidationSupportImpl(source);
- String actual = support.toClient(value, resources, translator);
+ String actual = support.toClient(value, resources, translator, nullFieldStrategy);
assertEquals(actual, clientValue);
@@ -297,7 +308,7 @@
// Return an innappropriate value.
- return handler.handleResult(this, null, null);
+ return handler.handleResult(this);
}
};
@@ -313,7 +324,7 @@
try
{
- support.toClient(value, resources, translator);
+ support.toClient(value, resources, translator, null);
unreachable();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java Fri Feb 1 16:07:33 2008
@@ -322,7 +322,7 @@
ComponentEventCallback handler = (ComponentEventCallback) EasyMock
.getCurrentArguments()[2];
- handler.handleResult(new Object[]{"foo", "bar"}, null, null);
+ handler.handleResult(new Object[]{"foo", "bar"});
return true;
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/NullFieldStrategySourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/NullFieldStrategySourceImplTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/NullFieldStrategySourceImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/NullFieldStrategySourceImplTest.java Fri Feb 1 16:07:33 2008
@@ -1,3 +1,17 @@
+// Copyright 2008 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.tapestry.internal.services;
import org.apache.tapestry.NullFieldStrategy;
@@ -50,10 +64,5 @@
"Unrecognized name 'wilma' locating a null field strategy. Available strategies: barney, fred.");
}
- }
-
- protected final NullFieldStrategy mockNullFieldStrategy()
- {
- return newMock(NullFieldStrategy.class);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessorTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessorTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessorTest.java Fri Feb 1 16:07:33 2008
@@ -15,7 +15,6 @@
package org.apache.tapestry.internal.services;
import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.ioc.internal.util.TapestryException;
import org.apache.tapestry.runtime.Component;
import org.apache.tapestry.services.ComponentEventResultProcessor;
import org.apache.tapestry.test.TapestryTestCase;
@@ -29,7 +28,7 @@
{
@SuppressWarnings("unchecked")
@Test
- public void invocation_is_failure()
+ public void invocation_is_failure() throws Exception
{
ComponentResources resources = mockComponentResources();
Component component = mockComponent();
@@ -46,17 +45,16 @@
try
{
- p.processResultValue(result, component, "foo.component.Gnop.blip()");
+ p.processResultValue(result);
unreachable();
}
- catch (TapestryException ex)
+ catch (RuntimeException ex)
{
- assertEquals(ex.getMessage(),
- "An event handler for component foo.Bar:gnip.gnop returned the value *INVALID* (from method foo.component.Gnop.blip()). " + "Return type java.lang.String can not be handled. " + "Configured return types are java.lang.String, java.util.List, java.util.Map.");
- }
- catch (java.io.IOException e)
- {
- throw new RuntimeException(e);
+ assertMessageContains(ex,
+ "A component event handler method returned the value *INVALID*.",
+ "Return type java.lang.String can not be handled.",
+ "Configured return types are java.lang.String, java.util.List, java.util.Map.");
+
}
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/util/NotificationEventCallbackTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/util/NotificationEventCallbackTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/util/NotificationEventCallbackTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/util/NotificationEventCallbackTest.java Fri Feb 1 16:07:33 2008
@@ -35,7 +35,7 @@
NotificationEventCallback callback = new NotificationEventCallback(EVENT_TYPE, COMPLETE_ID);
- assertTrue(callback.handleResult(Boolean.TRUE, component, METHOD));
+ assertTrue(callback.handleResult(Boolean.TRUE));
verify();
}
@@ -49,7 +49,7 @@
NotificationEventCallback callback = new NotificationEventCallback(EVENT_TYPE, COMPLETE_ID);
- assertFalse(callback.handleResult(Boolean.FALSE, component, METHOD));
+ assertFalse(callback.handleResult(Boolean.FALSE));
verify();
}
@@ -57,25 +57,21 @@
@Test
public void other_values_force_exception()
{
- Component component = mockComponent();
String result = "*RESULT*";
- replay();
-
NotificationEventCallback callback = new NotificationEventCallback(EVENT_TYPE, COMPLETE_ID);
try
{
- callback.handleResult(result, component, METHOD);
+ callback.handleResult(result);
unreachable();
}
catch (IllegalArgumentException ex)
{
- assertEquals(ex.getMessage(),
- "Event 'myEventType' from foo.bar.baz received an event handler method return value of *RESULT* from foo.components.Baz.bar(). " + "This type of event does not support return values from event handler methods.");
+ assertMessageContains(ex,
+ "Event 'myEventType' from foo.bar.baz received an event handler method return value of *RESULT*.",
+ "This type of event does not support return values from event handler methods.");
}
-
- verify();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java Fri Feb 1 16:07:33 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -150,7 +150,8 @@
String message = t.getMessage();
for (String substring : substrings)
- assertTrue(message.contains(substring));
+ assertTrue(message.contains(substring),
+ String.format("String '%s' not found in '%s'.", substring, message));
}
/**