Add FeatureMethodErrorTests

Capture common mistakes with @Feature method declarations and ensure
that useful error messages are produced.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3966 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Chris Beams
2011-02-09 06:54:02 +00:00
parent 0146bf787a
commit 8fcce02cde
3 changed files with 133 additions and 8 deletions
@@ -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>();