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

Support JUnit @Order annotation for classes by default in profile aware class orderer #44988

Closed
holly-cummins opened this issue Dec 8, 2024 · 1 comment

Comments

@holly-cummins
Copy link
Contributor

holly-cummins commented Dec 8, 2024

When users don't specify an orderer, we should honor the @Order annotations. We also would need a test for this.

Best done after #34681 to avoid merge woes.

(Also a bit relevant to #42715.)

We currently use the ClassName class orderer:

       return Optional.ofNullable(getConfigParam(CFGKEY_SECONDARY_ORDERER, null, context))
                .map(fqcn -> {
                    try {
                        return (ClassOrderer) Class.forName(fqcn)
                                .getDeclaredConstructor()
                                .newInstance();
                    } catch (ReflectiveOperationException e) {
                        throw new IllegalArgumentException("Failed to instantiate " + fqcn, e);
                    }
                })
                .orElseGet(ClassOrderer.ClassName::new);

... but it should probably use the org.junit.jupiter.api.ClassOrderer$OrderAnnotation by default.

@holly-cummins holly-cummins converted this from a draft issue Dec 8, 2024
@holly-cummins holly-cummins changed the title Support JUnit default classloaders by default in profile aware class orderer Support JUnit @Order annotation for classes by default in profile aware class orderer Dec 8, 2024
@holly-cummins
Copy link
Contributor Author

Closing, because I've just checked the docs, and @Order is not yet a default for JUnit classes:

For example, for the @order annotation to be honored on test classes, you should configure the ClassOrderer.OrderAnnotation class orderer using the configuration parameter with the corresponding fully qualified class name (e.g., in src/test/resources/junit-platform.properties):

@holly-cummins holly-cummins closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in WG - Test classloading Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant