In completion to INT-369, adding test cases for null-returning and void-returning Aggregator methods.
This commit is contained in:
@@ -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<Message<?>> 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<Message<?>> 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<String> message) {
|
||||
this.aggregationPerformed = true;
|
||||
}
|
||||
|
||||
public Message<?> doAggregationWithNullReturn(List<String> message) {
|
||||
this.aggregationPerformed = true;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Message<?> invalidParameterType(String invalid) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user