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

org.junit.jupiter.engine.descriptor.PdslInvocationContext Maven / Gradle / Ivy

Go to download

The Polymorphic DSL test framework was designed to solve the challenges with testing large, complex systems. Modern architecture requires software to run as distrubited systems or on multiple platforms. The conventional cost of testing these systems is quite high. PDSL allows a user to describe the system under test using a DSL of some kind: a picture, sentences in natural languages, graphs, etc. Using a common DSL allows someone to make deeply scalable tests. A simple change to the DSL could generate dozens of tests providing coverage through many layers of the test pyramid or even multiple applications.

The newest version!
package org.junit.jupiter.engine.descriptor;

import com.pdsl.testcases.TestCase;
import org.junit.jupiter.api.extension.*;

import java.util.Collections;
import java.util.List;

/**
 * An invocation context used by JUnit5 that has an embedded PDSL test.
 */
final class PdslInvocationContext implements TestTemplateInvocationContext {

    private final PdslExecutable executable;

    PdslInvocationContext(PdslExecutable executable) {
        this.executable = executable;
    }

    @Override
    public String getDisplayName(int invocationIndex) {
        return executable.getTestTitle();
    }

    @Override
    public List getAdditionalExtensions() {
        return Collections.singletonList(new ParameterResolver() {
            @Override
            public boolean supportsParameter(ParameterContext parameterContext,
                                             ExtensionContext extensionContext) {
                return parameterContext.getParameter().getType().equals(PdslExecutable.class);
            }

            @Override
            public Object resolveParameter(ParameterContext parameterContext,
                                           ExtensionContext extensionContext) {
                return executable;
            }
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy