Java Code Examples for org.junit.platform.launcher.TestIdentifier#getLegacyReportingName()

The following examples show how to use org.junit.platform.launcher.TestIdentifier#getLegacyReportingName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JupiterTestCollector.java    From sbt-jupiter-interface with Apache License 2.0 6 votes vote down vote up
private String fullyQualifiedName(TestIdentifier testIdentifier) {

        TestSource testSource = testIdentifier.getSource().orElse(null);

        if (testSource instanceof ClassSource) {

            ClassSource classSource = (ClassSource)testSource;
            return classSource.getClassName();
        }

        if (testSource instanceof MethodSource) {

            MethodSource methodSource = (MethodSource)testSource;
            return methodSource.getClassName()
                    + '#' + methodSource.getMethodName()
                    + '(' + methodSource.getMethodParameterTypes() + ')';
        }

        return testIdentifier.getLegacyReportingName();
    }
 
Example 2
Source File: TreePrintingTestListener.java    From sbt-jupiter-interface with Apache License 2.0 5 votes vote down vote up
@Override
public void executionFinished(TestIdentifier identifier, TestExecutionResult result) {

    Throwable throwable = result.getThrowable().orElse(null);
    String fqn, message;

    switch (result.getStatus()) {
        case ABORTED:
            fqn = configuration.buildErrorName(identifier);
            message = configuration.buildErrorMessage(throwable);
            message = "Test assumption in test " + fqn + " failed: " + message;
            logger.warn(message);
            break;
        case FAILED:
            fqn = configuration.buildErrorName(identifier);
            message = configuration.buildErrorMessage(throwable);
            message = "Test " + fqn + " failed: " + message;
            logger.error(configuration.extractClassName(identifier), message, throwable);
            break;
        case SUCCESSFUL:
            fqn = identifier.getLegacyReportingName();
            message = "Test " + fqn + " finished";
            logger.debug(message);
            break;
    }

    maybeDecreaseIndent(identifier);
}