Skip to content
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

Improve initialization of org.springframework.tests.Assume [SPR-15163] #19729

Closed
spring-projects-issues opened this issue Jan 18, 2017 · 1 comment
Assignees
Labels
type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jan 18, 2017

Rob Winch opened SPR-15163 and commented

Currently org.springframework.tests.Assume initializes based upon a static initialization of TestGroup.parse(System.getProperty("testGroups")).

If the parsing fails, using Assume will produce a NoClassDefFoundError since it could not be initialized.

It would be good if we could handle this error better and provide an informative error message to the user indicating that the testGroups could not be parsed.


Affects: 5.0 M4

Referenced from: commits 264edb3

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 19, 2017

Sam Brannen commented

Resolved as described in GitHub commit 264edb3f:

Improve initialization of Assume class

Prior to this commit, the org.springframework.tests.Assume class could
fail to load resulting in a NoClassDefFoundError if parsing of the
'testGroups' system property failed. This is because the parsing took
place while initializing a static field.

This commit addresses this issue by moving the 'testGroups' system
property lookup to a dedicated method that is lazily invoked upon
demand instead of eagerly when loading the Assume class itself.

In addition, when an error occurs, TestGroup.parse() now logs the
complete original value of the supplied test groups string instead of
potentially omitting the "all-" prefix. This results in more
informative error messages similar to the following.

java.lang.IllegalStateException: Failed to parse 'testGroups' system
property: Unable to find test group 'bogus' when parsing testGroups
value: 'all-bogus'. Available groups include:
[LONG_RUNNING,PERFORMANCE,JMXMP,CI]

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

No branches or pull requests

2 participants