Use findAnnotationAttributes() where appropriate
This commit updates code that previously used getAnnotationAttributes() in AnnotatedElementUtils to use findAnnotationAttributes(), where appropriate. Issue: SPR-12738
This commit is contained in:
parent
ebed52cc22
commit
bccd59e6c8
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -86,7 +86,7 @@ class MergedSqlConfig {
|
|||
Assert.notNull(testClass, "testClass must not be null");
|
||||
|
||||
// Get global attributes, if any.
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.getAnnotationAttributes(testClass,
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.findAnnotationAttributes(testClass,
|
||||
SqlConfig.class.getName());
|
||||
|
||||
// Override global attributes with local attributes.
|
||||
|
|
|
@ -380,7 +380,7 @@ public class SpringJUnit4ClassRunner extends BlockJUnit4ClassRunner {
|
|||
* @return the timeout, or {@code 0} if none was specified
|
||||
*/
|
||||
protected long getSpringTimeout(FrameworkMethod frameworkMethod) {
|
||||
AnnotationAttributes annAttrs = AnnotatedElementUtils.getAnnotationAttributes(frameworkMethod.getMethod(),
|
||||
AnnotationAttributes annAttrs = AnnotatedElementUtils.findAnnotationAttributes(frameworkMethod.getMethod(),
|
||||
Timed.class.getName());
|
||||
if (annAttrs == null) {
|
||||
return 0;
|
||||
|
|
|
@ -156,8 +156,8 @@ public class DirtiesContextTestExecutionListener extends AbstractTestExecutionLi
|
|||
Assert.notNull(testMethod, "The test method of the supplied TestContext must not be null");
|
||||
|
||||
final String annotationType = DirtiesContext.class.getName();
|
||||
AnnotationAttributes methodAnnAttrs = AnnotatedElementUtils.getAnnotationAttributes(testMethod, annotationType);
|
||||
AnnotationAttributes classAnnAttrs = AnnotatedElementUtils.getAnnotationAttributes(testClass, annotationType);
|
||||
AnnotationAttributes methodAnnAttrs = AnnotatedElementUtils.findAnnotationAttributes(testMethod, annotationType);
|
||||
AnnotationAttributes classAnnAttrs = AnnotatedElementUtils.findAnnotationAttributes(testClass, annotationType);
|
||||
boolean methodAnnotated = methodAnnAttrs != null;
|
||||
boolean classAnnotated = classAnnAttrs != null;
|
||||
MethodMode methodMode = methodAnnotated ? methodAnnAttrs.<MethodMode> getEnum("methodMode") : null;
|
||||
|
@ -186,7 +186,7 @@ public class DirtiesContextTestExecutionListener extends AbstractTestExecutionLi
|
|||
Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");
|
||||
|
||||
final String annotationType = DirtiesContext.class.getName();
|
||||
AnnotationAttributes classAnnAttrs = AnnotatedElementUtils.getAnnotationAttributes(testClass, annotationType);
|
||||
AnnotationAttributes classAnnAttrs = AnnotatedElementUtils.findAnnotationAttributes(testClass, annotationType);
|
||||
boolean classAnnotated = classAnnAttrs != null;
|
||||
ClassMode classMode = classAnnotated ? classAnnAttrs.<ClassMode> getEnum("classMode") : null;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -500,7 +500,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
|||
if (this.configurationAttributes == null) {
|
||||
Class<?> clazz = testContext.getTestClass();
|
||||
|
||||
AnnotationAttributes annAttrs = AnnotatedElementUtils.getAnnotationAttributes(clazz,
|
||||
AnnotationAttributes annAttrs = AnnotatedElementUtils.findAnnotationAttributes(clazz,
|
||||
TransactionConfiguration.class.getName());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("Retrieved @TransactionConfiguration attributes [%s] for test class [%s].",
|
||||
|
|
Loading…
Reference in New Issue