From 8c4307cac06549269d4e33cd0cbdcafd4dc8e7ff Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 25 Jun 2009 02:46:58 +0000 Subject: [PATCH] Adjusted JavaDoc for handler method validation after INT-682 changes. --- .../integration/handler/HandlerMethodUtils.java | 8 ++++---- .../handler/StaticHandlerMethodResolverTests.java | 15 ++++++++------- .../MethodInvokingMessageHandlerTests.java | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/handler/HandlerMethodUtils.java b/org.springframework.integration/src/main/java/org/springframework/integration/handler/HandlerMethodUtils.java index c40ea24e1c..762ed7f45f 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/handler/HandlerMethodUtils.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/handler/HandlerMethodUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,9 +36,9 @@ abstract class HandlerMethodUtils { /** * Verifies that the provided Method is capable of handling Messages. - * It must accept at least one parameter, and if it expects more than one - * parameter, at most one of them may expect the payload object. Others - * must be annotated for accepting Message header values. + * It must be public, and not defined directly on Object. If it expects + * more than one parameter, at most one of them may expect the payload + * object. Others must be annotated for accepting Message header values. */ public static boolean isValidHandlerMethod(Method method) { if (method.getDeclaringClass().equals(Object.class)) { diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java index 44c860ffd7..d740014989 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/handler/StaticHandlerMethodResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.handler; import static org.junit.Assert.assertEquals; @@ -38,12 +39,6 @@ public class StaticHandlerMethodResolverTests { new StaticHandlerMethodResolver(method); } - @Test - public void noArgMethodIsNotValid() throws Exception { - Method method = TestBean.class.getDeclaredMethod("noArgMethod", new Class[0]); - new StaticHandlerMethodResolver(method); - } - @Test(expected = IllegalArgumentException.class) public void privateMethodIsNotValid() throws Exception { Method method = TestBean.class.getDeclaredMethod("privateMethod", new Class[] {String.class}); @@ -70,6 +65,12 @@ public class StaticHandlerMethodResolverTests { assertEquals(method, resolved); } + @Test + public void validNoArgMethod() throws Exception { + Method method = TestBean.class.getDeclaredMethod("noArgMethod", new Class[0]); + new StaticHandlerMethodResolver(method); + } + @Test public void validHeaderMethod() throws Exception { Method method = TestBean.class.getDeclaredMethod("headerMethod", new Class[] {String.class}); diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java index b502725fda..acd76f3b2d 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/message/MethodInvokingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ public class MethodInvokingMessageHandlerTests { } @Test - public void invalidMethodWithNoArgs() { + public void validMethodWithNoArgs() { new MethodInvokingMessageHandler(new TestSink(), "validMethodWithNoArgs"); }