Top Description Interfaces Annotations Classes
module org.junit.jupiter.api

Package org.junit.jupiter.api

Annotations
@NullMarked
Imports
org.jspecify.annotations.NullMarked

JUnit Jupiter API for writing tests.

Interface Summary

Modifier and TypeInterface and Description
public interface
ClassDescriptor

ClassDescriptor encapsulates functionality for a given Class.

public interface
ClassOrderer

ClassOrderer defines the API for ordering top-level test classes and @Nested test classes.

public interface
ClassOrdererContext

ClassOrdererContext encapsulates the context in which a ClassOrderer will be invoked.

public interface
DisplayNameGenerator

DisplayNameGenerator defines the SPI for generating display names programmatically.

public interface
MethodDescriptor

MethodDescriptor encapsulates functionality for a given Method.

public interface
MethodOrderer

MethodOrderer defines the API for ordering the test methods in a given test class.

public interface
MethodOrdererContext

MethodOrdererContext encapsulates the context in which a MethodOrderer will be invoked.

public interface
Named<
the type of the payload
T extends @Nullable Object
>

Named is a container that associates a name with a given payload.

public interface
NamedExecutable

NamedExecutable joins Executable and Named in a one self-typed functional interface.

public interface
RepetitionInfo

RepetitionInfo is used to inject information about the current repetition of a repeated test into @RepeatedTest, @BeforeEach, and @AfterEach methods.

public interface
TestInfo

TestInfo is used to inject information about the current test or container into to @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, @BeforeEach, @AfterEach, @BeforeAll, and @AfterAll methods.

public interface
TestReporter

Parameters of type TestReporter can be injected into @BeforeEach and @AfterEach lifecycle methods as well as methods annotated with @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, etc.

Within such methods the injected TestReporter can be used to publish report entries for the current container or test to the reporting infrastructure.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
AfterAll

@AfterAll is used to signal that the annotated method should be executed after all tests in the current test class.

public @interface
AfterEach

@AfterEach is used to signal that the annotated method should be executed after each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, and @TestTemplate method in the current test class.

public @interface
AutoClose

@AutoClose is used to indicate that an annotated field will be automatically closed after test execution.

public @interface
BeforeAll

@BeforeAll is used to signal that the annotated method should be executed before all tests in the current test class.

public @interface
BeforeEach

@BeforeEach is used to signal that the annotated method should be executed before each @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, and @TestTemplate method in the current test class.

public @interface
ClassTemplate

@ClassTemplate is used to signal that the annotated class is a class template.

public @interface
Disabled

@Disabled is used to signal that the annotated test class or test method is currently disabled and should not be executed.

public @interface
DisplayName

@DisplayName is used to declare a custom display name for the annotated test class or test method.

public @interface
DisplayNameGeneration

@DisplayNameGeneration is used to declare a custom display name generator for the annotated test class.

public @interface
IndicativeSentencesGeneration

@IndicativeSentencesGeneration is used to register the IndicativeSentences display name generator and configure it.

public @interface
Nested

@Nested is used to signal that the annotated class is a nested, non-static test class (i.e., an inner class) that can share setup and state with an instance of its enclosing class.

public @interface
Order

@Order is an annotation that is used to configure the order in which the annotated element (i.e., field, method, or class) should be evaluated or executed relative to other elements of the same category.

public @interface
RepeatedTest

@RepeatedTest is used to signal that the annotated method is a test template method that should be repeated a specified number of times with a configurable display name and an optional failure threshold.

public @interface
Tag

@Tag is a repeatable annotation that is used to declare a tag for the annotated test class or test method.

public @interface
Tags

@Tags is a container for one or more @Tag declarations.

public @interface
Test

@Test is used to signal that the annotated method is a test method.

public @interface
TestClassOrder

@TestClassOrder is a type-level annotation that is used to configure a ClassOrderer for the @Nested test classes of the annotated test class.

public @interface
TestFactory

@TestFactory is used to signal that the annotated method is a test factory method.

public @interface
TestInstance

@TestInstance is a type-level annotation that is used to configure the lifecycle of test instances for the annotated test class or test interface.

public @interface
TestMethodOrder

@TestMethodOrder is a type-level annotation that is used to configure a MethodOrderer for the test methods of the annotated test class or test interface.

public @interface
TestTemplate

@TestTemplate is used to signal that the annotated method is a test template method.

public @interface
Timeout

@Timeout is used to define a timeout for a method or all testable methods within one class and its @Nested classes.

Class Summary

Modifier and TypeClass and Description
pack-priv class
AssertAll

AssertAll is a collection of utility methods that support asserting multiple conditions in tests at once.

pack-priv class
AssertArrayEquals

AssertArrayEquals is a collection of utility methods that support asserting array equality in tests.

pack-priv class
AssertDoesNotThrow

AssertDoesNotThrow is a collection of utility methods that support explicitly asserting that a given code block does not throw an exception.

pack-priv class
AssertEquals

AssertEquals is a collection of utility methods that support asserting equality on objects and primitives in tests.

pack-priv class
AssertFalse

AssertFalse is a collection of utility methods that support asserting false in tests.

pack-priv class
AssertInstanceOf

AssertInstanceOf is a collection of utility methods that support asserting that an object is of an expected type — in other words, if it can be assigned to the expected type.

public class
public class
Assertions

Assertions is a collection of utility methods that support asserting conditions in tests.

pack-priv class
AssertionUtils

AssertionUtils is a collection of utility methods that are common to all assertion implementations.

pack-priv class
AssertIterableEquals

AssertIterable is a collection of utility methods that support asserting Iterable equality in tests.

pack-priv class
AssertLinesMatch

AssertLinesMatch is a collection of utility methods that support asserting lines of String equality or java.util.regex.Pattern-match in tests.

pack-priv class
AssertNotEquals

AssertNotEquals is a collection of utility methods that support asserting inequality in objects and primitive values in tests.

pack-priv class
AssertNotNull

AssertNotNull is a collection of utility methods that support asserting that there is an object.

pack-priv class
AssertNotSame

AssertNotSame is a collection of utility methods that support asserting two objects are not the same.

pack-priv class
AssertNull

AssertNull is a collection of utility methods that support asserting there is no object.

pack-priv class
AssertSame

AssertSame is a collection of utility methods that support asserting two objects are the same.

pack-priv class
AssertThrows

AssertThrows is a collection of utility methods that support asserting an exception of an expected type is thrown.

pack-priv class
AssertThrowsExactly

AssertThrowsExactly is a collection of utility methods that support asserting an exception of an exact type is thrown.

pack-priv class
AssertTimeout

AssertTimeout is a collection of utility methods that support asserting the execution of the code under test did not take longer than the timeout duration.

pack-priv class
AssertTimeoutPreemptively

AssertTimeout is a collection of utility methods that support asserting the execution of the code under test did not take longer than the timeout duration using a preemptive approach.

pack-priv class
AssertTrue

AssertTrue is a collection of utility methods that support asserting true in tests.

public class
Assumptions

Assumptions is a collection of utility methods that support conditional test execution based on assumptions.

public class
DynamicContainer

A DynamicContainer is a container generated at runtime.

public abstract class
DynamicNode

DynamicNode serves as the abstract base class for a container or a test case generated at runtime.

public class
DynamicTest

A DynamicTest is a test case generated at runtime.

public class
MediaType

Represents a media type as defined by RFC 2045.

pack-priv class
RandomOrdererUtils

Shared utility methods for ordering test classes and test methods randomly.