Skip to content

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

@holly-cummins

Description

@holly-cummins

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions