Class<? extends ActiveProfilesResolver> resolverClass = annAttrs.getClass("resolver");
if (ActiveProfilesResolver.class.equals(resolverClass)) {
resolverClass = DefaultActiveProfilesResolver.class;
}
ActiveProfilesResolver resolver = null;
try {
resolver = BeanUtils.instantiateClass(resolverClass, ActiveProfilesResolver.class);
}
catch (Exception e) {
String msg = String.format("Could not instantiate ActiveProfilesResolver of "
+ "type [%s] for test class [%s].", resolverClass.getName(), rootDeclaringClass.getName());
logger.error(msg);
throw new IllegalStateException(msg, e);
}
String[] profiles = resolver.resolve(rootDeclaringClass);
if (profiles == null) {
String msg = String.format(
"ActiveProfilesResolver [%s] returned a null array of bean definition profiles.",
resolverClass.getName());
logger.error(msg);