Add test method reflecting the fact that the only type of parameter that is supported by AggregatorAdapter is Collection<?> and not one of the Collection subclasses. This might change in a future version.

This commit is contained in:
Marius Bogoevici
2008-03-04 16:44:18 +00:00
parent e37e22eb76
commit f987d920aa

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.router;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
@@ -107,6 +108,11 @@ public class AggregatorAdapterTests {
new AggregatorAdapter(simpleAggregator, "notEnoughParameters");
}
@Test(expected=MessagingConfigurationException.class)
public void testCollectionSubclassParameterUsingMethodName() {
new AggregatorAdapter(simpleAggregator, "collectionSubclassParameter");
}
@Test(expected=MessagingConfigurationException.class)
public void testInvalidParameterTypeUsingMethodObject() throws SecurityException, NoSuchMethodException {
new AggregatorAdapter(simpleAggregator, simpleAggregator.getClass().getMethod(
@@ -125,6 +131,12 @@ public class AggregatorAdapterTests {
"notEnoughParameters", new Class[] {} ));
}
@Test(expected= MessagingConfigurationException.class)
public void testCollectionSubclassParameterUsingMethodObject() throws SecurityException, NoSuchMethodException {
new AggregatorAdapter(simpleAggregator, simpleAggregator.getClass().getMethod(
"collectionSubclassParameter", new Class[] {List.class} ));
}
@Test(expected=IllegalArgumentException.class)
public void testNullObject() {
new AggregatorAdapter(null, "doesNotMatter");
@@ -222,6 +234,10 @@ public class AggregatorAdapterTests {
public Message<?> notEnoughParameters() {
return null;
}
public Message<?> collectionSubclassParameter(List<?> l1){
return null;
}
}
}