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:
@@ -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[] {});
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user