Skip to content

SPR-12031 Support @ContextConfiguration at method level #1255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

fdesu
Copy link
Contributor

@fdesu fdesu commented Dec 6, 2016

Prior Spring TestContext Framework had not supported
@ContextConfiguration annotation on the method-level.

This commit enables @ContextConfiguration and
@ContextHierarchy to be the method-level annotations.
Now TCF will emit fully configured throw-away
TestContext for the particular test method.

Issue: SPR-12031

@fdesu fdesu force-pushed the feature/SPR-12031-rebase branch 8 times, most recently from a8bb1f2 to 4f7aed0 Compare December 7, 2016 09:50
Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply the requested changes in order to reduce the amount of noise in this commit.

Thanks!

import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, contributors are required to adhere to the Spring Framework Code Style. So please familiarize yourself with that and rework your PR.

For example, you need to undo all changes to import ordering and static imports throughout all changed classes.

assertTrue(isAnnotationDeclaredLocally(Order.class, NonInheritedAnnotationClass.class));
assertFalse(isAnnotationDeclaredLocally(Order.class, SubNonInheritedAnnotationClass.class));
}
// non-inherited class-level annotation; note: @Order is not inherited
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that you formatted code that you have not authored or modified, which is not permissible according to Spring's coding guidelines.

Also, it appears you may be using the wrong indentation settings.

@@ -105,7 +110,7 @@
}

// Declared locally?
if (AnnotationUtils.isAnnotationDeclaredLocally(annotationType, clazz)) {
if (isAnnotationDeclaredLocally(annotationType, clazz)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Production code is not allowed to use static imports.

@fdesu
Copy link
Contributor Author

fdesu commented Dec 12, 2016

@sbrannen
Thank you for your remarks, will fix them asap!
Can you please advice if such declarations permitted. Or should I pull this classes in the different files/into some class as inner classes.
Asking because it is forbidden by the Code Style.

@sbrannen
Copy link
Member

Can you please advice if such declarations permitted. Or should I pull this classes in the different files/into some class as inner classes.
Asking because it is forbidden by the Code Style.

It's definitely forbidden in production code. In test code, I think there are few places where that style is used. But I don't want that in the spring-test module. So please convert them to static nested classes within the test class.

Thanks

@fdesu fdesu force-pushed the feature/SPR-12031-rebase branch from 4f7aed0 to e3d8c85 Compare December 18, 2016 14:08
Prior Spring TestContext Framework had not supported
@ContextConfiguration annotation on the method-level.

This commit enables @ContextConfiguration and
@ContextHierarchy to be the method-level annotations.
Now TCF will emit fully configured throw-away
TestContext for the particular test method.

Issue: SPR-12031
@fdesu fdesu force-pushed the feature/SPR-12031-rebase branch from e3d8c85 to ae37c63 Compare December 18, 2016 14:22
@fdesu
Copy link
Contributor Author

fdesu commented Dec 18, 2016

@sbrannen
I amended previous commit and hope that current one is easier to review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants