MessageMappingMethodInvoker now uses Assert instead of throwing ConfigurationException if the method does not accept any arguments.
This commit is contained in:
@@ -104,9 +104,7 @@ public class MessageMappingMethodInvoker implements MethodInvoker, InitializingB
|
||||
}
|
||||
if (this.method != null) {
|
||||
Class<?>[] parameterTypes = this.method.getParameterTypes();
|
||||
if (parameterTypes.length == 0) {
|
||||
throw new ConfigurationException("method must accept at least one parameter");
|
||||
}
|
||||
Assert.isTrue(parameterTypes.length > 0, "method must accept at least one parameter");
|
||||
if (parameterTypes.length == 1 && Message.class.isAssignableFrom(parameterTypes[0])) {
|
||||
this.methodExpectsMessage = true;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MethodInvokingConsumerTests {
|
||||
consumer.onMessage(new GenericMessage<String>("test"));
|
||||
}
|
||||
|
||||
@Test(expected = ConfigurationException.class)
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testInvalidMethodWithNoArgs() {
|
||||
MethodInvokingConsumer consumer = new MethodInvokingConsumer(new TestSink(), "invalidMethodWithNoArgs");
|
||||
consumer.afterPropertiesSet();
|
||||
|
||||
Reference in New Issue
Block a user