Add FeatureMethodErrorTests

Capture common mistakes with @Feature method declarations and ensure
that useful error messages are produced.
This commit is contained in:
Chris Beams
2011-02-09 06:54:02 +00:00
parent 6926e0f563
commit 906b50ef51
3 changed files with 133 additions and 8 deletions

View File

@@ -322,7 +322,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
if (!(FeatureSpecification.class.isAssignableFrom(featureMethod.getReturnType()))) {
// TODO SPR-7420: raise a Problem instead?
throw new IllegalArgumentException(
"return type from @Feature methods must be assignable to FeatureSpecification");
format("Return type for @Feature method %s.%s() must be assignable to FeatureSpecification",
featureMethod.getDeclaringClass().getSimpleName(), featureMethod.getName()));
}
List<Object> beanArgs = new ArrayList<Object>();