final String annotationType = DirtiesContext.class.getName();
AnnotationAttributes methodAnnAttrs = AnnotatedElementUtils.getAnnotationAttributes(testMethod, annotationType);
AnnotationAttributes classAnnAttrs = AnnotatedElementUtils.getAnnotationAttributes(testClass, annotationType);
boolean methodDirtiesContext = methodAnnAttrs != null;
boolean classDirtiesContext = classAnnAttrs != null;
ClassMode classMode = classDirtiesContext ? classAnnAttrs.<ClassMode> getEnum("classMode") : null;
if (logger.isDebugEnabled()) {
logger.debug(String.format(
"After test method: context %s, class dirties context [%s], class mode [%s], method dirties context [%s].",
testContext, classDirtiesContext, classMode, methodDirtiesContext));