diff --git a/spring-integration-core/src/test/java/org/springframework/integration/adapter/MethodInvokingSourceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/adapter/MethodInvokingSourceTests.java index c4f1c54306..9b8f97d4a1 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/adapter/MethodInvokingSourceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/adapter/MethodInvokingSourceTests.java @@ -31,28 +31,51 @@ import org.springframework.integration.MessageDeliveryException; public class MethodInvokingSourceTests { @Test - public void testSingleObjectResult() { + public void testValidMethod() { MethodInvokingSource source = new MethodInvokingSource(); source.setObject(new TestBean()); - source.setMethod("foo"); + source.setMethod("validMethod"); Collection result = source.poll(5); assertNotNull(result); - assertEquals("bar", result.iterator().next()); + assertEquals("valid", result.iterator().next()); } @Test(expected=MessageDeliveryException.class) - public void testInvalidMethod() { + public void testNoMatchingMethodName() { MethodInvokingSource source = new MethodInvokingSource(); source.setObject(new TestBean()); - source.setMethod("boo"); + source.setMethod("noMatchingMethod"); + source.poll(5); + } + + @Test(expected=MessageDeliveryException.class) + public void testInvalidMethodWithArg() { + MethodInvokingSource source = new MethodInvokingSource(); + source.setObject(new TestBean()); + source.setMethod("invalidMethodWithArg"); + source.poll(5); + } + + @Test(expected=MessageDeliveryException.class) + public void testInvalidMethodWithNoReturnValue() { + MethodInvokingSource source = new MethodInvokingSource(); + source.setObject(new TestBean()); + source.setMethod("invalidMethodWithNoReturnValue"); source.poll(5); } private static class TestBean { - public String foo() { - return "bar"; + public String validMethod() { + return "valid"; + } + + public String invalidMethodWithArg(String arg) { + return "invalid"; + } + + public void invalidMethodWithNoReturnValue() { } }