diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/aggregator/MethodInvokingAggregatorTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/aggregator/MethodInvokingAggregatorTests.java index 4f941f302a..16be9fd187 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/aggregator/MethodInvokingAggregatorTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/aggregator/MethodInvokingAggregatorTests.java @@ -88,6 +88,24 @@ public class MethodInvokingAggregatorTests { Assert.assertTrue(simpleAggregator.isAggregationPerformed()); Assert.assertEquals(123456789l, returnedMessge.getPayload()); } + + @Test + public void testAdapterWithVoidReturnType() { + Aggregator aggregator = new MethodInvokingAggregator(simpleAggregator, "doAggregationWithNoReturn"); + List> messages = createListOfMessages(); + Message returnedMessage = aggregator.aggregate(messages); + Assert.assertTrue(simpleAggregator.isAggregationPerformed()); + Assert.assertNull(returnedMessage); + } + + @Test + public void testAdapterWithNullReturn() { + Aggregator aggregator = new MethodInvokingAggregator(simpleAggregator, "doAggregationWithNullReturn"); + List> messages = createListOfMessages(); + Message returnedMessage = aggregator.aggregate(messages); + Assert.assertTrue(simpleAggregator.isAggregationPerformed()); + Assert.assertNull(returnedMessage); + } @Test(expected=ConfigurationException.class) public void testAdapterWithWrongMethodName() { @@ -223,6 +241,15 @@ public class MethodInvokingAggregatorTests { } return Long.parseLong(buffer.toString()); } + + public void doAggregationWithNoReturn(List message) { + this.aggregationPerformed = true; + } + + public Message doAggregationWithNullReturn(List message) { + this.aggregationPerformed = true; + return null; + } public Message invalidParameterType(String invalid) { return null;