Top Description Inners Fields Constructors Methods
org.junit.platform.engine

public Class TestExecutionResult

extends Object
Class Inheritance
Annotations
@API
status:STABLE
since:1.0
Static Imports
org.apiguardian.api.API.Status.STABLE, org.junit.platform.engine.TestExecutionResult.Status.ABORTED, .TestExecutionResult.Status.FAILED, .TestExecutionResult.Status.SUCCESSFUL

TestExecutionResult encapsulates the result of executing a single test or container.

A TestExecutionResult consists of a mandatory Status and an optional Throwable.

Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
TestExecutionResult.Status

Status of executing a single test or container.

Field Summary

Modifier and TypeField and Description
private final TestExecutionResult.Status
private static final TestExecutionResult
private final @Nullable Throwable

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TestExecutionResult

Returns:

the TestExecutionResult; never null
aborted
(@Nullable Throwable
the throwable that caused the aborted execution; may be null
throwable
)

Create a TestExecutionResult for an aborted execution of a test or container with the supplied throwable.

public static TestExecutionResult

Returns:

the TestExecutionResult; never null
failed
(@Nullable Throwable
the throwable that caused the failed execution; may be null
throwable
)

Create a TestExecutionResult for a failed execution of a test or container with the supplied throwable.

public TestExecutionResult.Status

Returns:

the status; never null
getStatus
()

Get the status of this result.

public Optional<Throwable>

Returns:

an Optional containing the throwable; never null but potentially empty
getThrowable
()

Get the throwable that caused this result, if available.

public static TestExecutionResult

Returns:

the TestExecutionResult; never null
successful
()

Create a TestExecutionResult for a successful execution of a test or container.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

statusback to summary
private final TestExecutionResult.Status status
SUCCESSFUL_RESULTback to summary
private static final TestExecutionResult SUCCESSFUL_RESULT
throwableback to summary
private final @Nullable Throwable throwable

Constructor Detail

TestExecutionResultback to summary
private TestExecutionResult(TestExecutionResult.Status status, @Nullable Throwable throwable)

Method Detail

abortedback to summary
public static TestExecutionResult aborted(@Nullable Throwable throwable)

Create a TestExecutionResult for an aborted execution of a test or container with the supplied throwable.

Parameters
throwable:@Nullable Throwable

the throwable that caused the aborted execution; may be null

Returns:TestExecutionResult

the TestExecutionResult; never null

failedback to summary
public static TestExecutionResult failed(@Nullable Throwable throwable)

Create a TestExecutionResult for a failed execution of a test or container with the supplied throwable.

Parameters
throwable:@Nullable Throwable

the throwable that caused the failed execution; may be null

Returns:TestExecutionResult

the TestExecutionResult; never null

getStatusback to summary
public TestExecutionResult.Status getStatus()

Get the status of this result.

Returns:TestExecutionResult.Status

the status; never null

getThrowableback to summary
public Optional<Throwable> getThrowable()

Get the throwable that caused this result, if available.

Returns:Optional<Throwable>

an Optional containing the throwable; never null but potentially empty

successfulback to summary
public static TestExecutionResult successful()

Create a TestExecutionResult for a successful execution of a test or container.

Returns:TestExecutionResult

the TestExecutionResult; never null

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.junit.platform.engine back to summary

public final Enum TestExecutionResult.Status

extends Enum<TestExecutionResult.Status>
Class Inheritance

Status of executing a single test or container.

Field Summary

Modifier and TypeField and Description
public static final TestExecutionResult.Status
ABORTED

Indicates that the execution of a test or container was aborted (started but not finished).

public static final TestExecutionResult.Status
FAILED

Indicates that the execution of a test or container failed.

public static final TestExecutionResult.Status
SUCCESSFUL

Indicates that the execution of a test or container was successful.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TestExecutionResult.Status
public static TestExecutionResult.Status[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ABORTEDback to summary
public static final TestExecutionResult.Status ABORTED

Indicates that the execution of a test or container was aborted (started but not finished).

FAILEDback to summary
public static final TestExecutionResult.Status FAILED

Indicates that the execution of a test or container failed.

SUCCESSFULback to summary
public static final TestExecutionResult.Status SUCCESSFUL

Indicates that the execution of a test or container was successful.

Constructor Detail

Statusback to summary
private Status()

Method Detail

valueOfback to summary
public static TestExecutionResult.Status valueOf(String name)
valuesback to summary
public static TestExecutionResult.Status[] values()