INT-682, added no-arg method support for handlers, removed assertion for no-arg handler methods in HandlerMethodUtils and StaticHandlerMethodResolver, fixed test cases

This commit is contained in:
Oleg Zhurakousky
2009-06-25 02:32:34 +00:00
parent b6d2f17e2b
commit 42723d0918
5 changed files with 11 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
* @author Oleg Zhurakousky
*/
public class MethodInvokingSelectorTests {
@@ -60,13 +61,13 @@ public class MethodInvokingSelectorTests {
assertFalse(selector.accept(new GenericMessage<Integer>(99)));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void noArgMethodWithMethodName() {
MethodInvokingSelector selector = new MethodInvokingSelector(new TestBean(), "noArgs");
selector.accept(new StringMessage("test"));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void noArgMethodWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
Method method = testBean.getClass().getMethod("noArgs", new Class[] {});

View File

@@ -28,6 +28,7 @@ import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
* @author Oleg Zhurakousky
*/
public class StaticHandlerMethodResolverTests {
@@ -37,7 +38,7 @@ public class StaticHandlerMethodResolverTests {
new StaticHandlerMethodResolver(method);
}
@Test(expected = IllegalArgumentException.class)
@Test
public void noArgMethodIsNotValid() throws Exception {
Method method = TestBean.class.getDeclaredMethod("noArgMethod", new Class<?>[0]);
new StaticHandlerMethodResolver(method);

View File

@@ -37,6 +37,7 @@ import org.springframework.integration.util.TestUtils.TestApplicationContext;
/**
* @author Mark Fisher
* @author Oleg Zhurakousky
*/
public class MethodInvokingMessageHandlerTests {
@@ -46,9 +47,9 @@ public class MethodInvokingMessageHandlerTests {
handler.handleMessage(new GenericMessage<String>("test"));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void invalidMethodWithNoArgs() {
new MethodInvokingMessageHandler(new TestSink(), "invalidMethodWithNoArgs");
new MethodInvokingMessageHandler(new TestSink(), "validMethodWithNoArgs");
}
@Test(expected = MessagingException.class)
@@ -118,7 +119,7 @@ public class MethodInvokingMessageHandlerTests {
public void validMethod(String s) {
}
public void invalidMethodWithNoArgs() {
public void validMethodWithNoArgs() {
}
public String methodWithReturnValue(String s) {