diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageMappingMethodInvoker.java b/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageMappingMethodInvoker.java index e1c9552fc1..ff560b54f6 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageMappingMethodInvoker.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/message/MessageMappingMethodInvoker.java @@ -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; } diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingConsumerTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingConsumerTests.java index 85b3080f27..96629bcda0 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingConsumerTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingConsumerTests.java @@ -44,7 +44,7 @@ public class MethodInvokingConsumerTests { consumer.onMessage(new GenericMessage("test")); } - @Test(expected = ConfigurationException.class) + @Test(expected = IllegalArgumentException.class) public void testInvalidMethodWithNoArgs() { MethodInvokingConsumer consumer = new MethodInvokingConsumer(new TestSink(), "invalidMethodWithNoArgs"); consumer.afterPropertiesSet();