All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.test.ExclusivityChecker Maven / Gradle / Ivy

Go to download

A runner for unit tests, intended for testing Quarkus rather than for end user consumption.

There is a newer version: 3.17.5
Show newest version
package io.quarkus.test;

import org.junit.jupiter.api.extension.ExtensionContext;

public class ExclusivityChecker {
    public static final String IO_QUARKUS_TESTING_TYPE = "io.quarkus.testing.type";

    public static void checkTestType(ExtensionContext extensionContext, Class current) {
        ExtensionContext.Store store = extensionContext.getRoot().getStore(ExtensionContext.Namespace.GLOBAL);

        Class testType = store.get(IO_QUARKUS_TESTING_TYPE, Class.class);
        if (testType != null) {
            if (testType != QuarkusUnitTest.class && testType != QuarkusDevModeTest.class
                    && testType != QuarkusProdModeTest.class) {
                throw new IllegalStateException(
                        "Cannot mix both " + current.getName() + " based tests and " + testType.getName()
                                + " based tests in the same run");
            }
        } else {
            store.put(IO_QUARKUS_TESTING_TYPE, current);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy