Package org.junit.jupiter.api
JUnit Jupiter API for writing tests.
-
Interface Summary Interface Description DisplayNameGenerator DisplayNameGeneratordefines the SPI for generating display names programmatically.MethodDescriptor MethodDescriptorencapsulates functionality for a givenMethod.MethodOrderer MethodOrdererdefines the API for ordering the test methods in a given test class.MethodOrdererContext MethodOrdererContextencapsulates the context in which aMethodOrdererwill be invoked.RepetitionInfo RepetitionInfois used to inject information about the current repetition of a repeated test into@RepeatedTest,@BeforeEach, and@AfterEachmethods.TestInfo TestInfois used to inject information about the current test or container into to@Test,@RepeatedTest,@ParameterizedTest,@TestFactory,@BeforeEach,@AfterEach,@BeforeAll, and@AfterAllmethods.TestReporter Parameters of typeTestReportercan be injected into@BeforeEachand@AfterEachlifecycle methods as well as methods annotated with@Test,@RepeatedTest,@ParameterizedTest,@TestFactory, etc. -
Class Summary Class Description AssertAll AssertAllis a collection of utility methods that support asserting multiple conditions in tests at once.AssertArrayEquals AssertArrayEqualsis a collection of utility methods that support asserting array equality in tests.AssertDoesNotThrow AssertDoesNotThrowis a collection of utility methods that support explicitly asserting that a given code block does not throw an exception.AssertEquals AssertEqualsis a collection of utility methods that support asserting equality on objects and primitives in tests.AssertFalse AssertFalseis a collection of utility methods that support assertingfalsein tests.Assertions Assertionsis a collection of utility methods that support asserting conditions in tests.AssertionUtils AssertionUtilsis a collection of utility methods that are common to all assertion implementations.AssertIterableEquals AssertIterableis a collection of utility methods that support asserting Iterable equality in tests.AssertLinesMatch AssertLinesMatchis a collection of utility methods that support asserting lines ofStringequality orPattern-match in tests.AssertLinesMatch.LinesMatcher AssertNotEquals AssertNotEqualsis a collection of utility methods that support asserting inequality in objects and primitive values in tests.AssertNotNull AssertNotNullis a collection of utility methods that support asserting that there is an object.AssertNotSame AssertNotSameis a collection of utility methods that support asserting two objects are not the same.AssertNull AssertNullis a collection of utility methods that support asserting there is no object.AssertSame AssertSameis a collection of utility methods that support asserting two objects are the same.AssertThrows AssertThrowsis a collection of utility methods that support asserting an exception of an expected type is thrown.AssertTimeout AssertTimeoutis a collection of utility methods that support asserting the execution of the code under test did not take longer than the timeout duration.AssertTimeout.TimeoutThreadFactory The thread factory used for preemptive timeout.AssertTrue AssertTrueis a collection of utility methods that support assertingtruein tests.Assumptions Assumptionsis a collection of utility methods that support conditional test execution based on assumptions.DisplayNameGenerator.IndicativeSentences DisplayNameGeneratorthat generates complete sentences.DisplayNameGenerator.ReplaceUnderscores DisplayNameGeneratorthat replaces underscores with spaces.DisplayNameGenerator.Simple SimpleDisplayNameGeneratorthat removes trailing parentheses for methods with no parameters.DisplayNameGenerator.Standard StandardDisplayNameGenerator.DynamicContainer ADynamicContaineris a container generated at runtime.DynamicNode DynamicNodeserves as the abstract base class for a container or a test case generated at runtime.DynamicTest ADynamicTestis a test case generated at runtime.MethodOrderer.Alphanumeric Deprecated. Please useMethodOrderer.MethodNameinstead.MethodOrderer.DisplayName MethodOrdererthat sorts methods alphanumerically based on their display names usingString.compareTo(String)MethodOrderer.MethodName MethodOrdererthat sorts methods alphanumerically based on their names usingString.compareTo(String).MethodOrderer.OrderAnnotation MethodOrdererthat sorts methods based on the@Orderannotation.MethodOrderer.Random MethodOrdererthat orders methods pseudo-randomly. -
Enum Summary Enum Description TestInstance.Lifecycle Enumeration of test instance lifecycle modes. -
Exception Summary Exception Description AssertTimeout.ExecutionTimeoutException -
Annotation Types Summary Annotation Type Description AfterAll @AfterAllis used to signal that the annotated method should be executed after all tests in the current test class.AfterEach @AfterEachis used to signal that the annotated method should be executed after each@Test,@RepeatedTest,@ParameterizedTest,@TestFactory, and@TestTemplatemethod in the current test class.BeforeAll @BeforeAllis used to signal that the annotated method should be executed before all tests in the current test class.BeforeEach @BeforeEachis used to signal that the annotated method should be executed before each@Test,@RepeatedTest,@ParameterizedTest,@TestFactory, and@TestTemplatemethod in the current test class.Disabled @Disabledis used to signal that the annotated test class or test method is currently disabled and should not be executed.DisplayName @DisplayNameis used to declare a custom display name for the annotated test class or test method.DisplayNameGeneration @DisplayNameGenerationis used to declare a custom display name generator for the annotated test class.IndicativeSentencesGeneration @IndicativeSentencesGenerationis used to declare a custom parameters byIndicativeSentences, if this notation has some not declared parameters, it will use the default values instead.Nested @Nestedis 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.Order @Orderis an annotation that is used to configure the order in which the annotated element (i.e., field or method) should be evaluated or executed relative to other elements of the same category.RepeatedTest @RepeatedTestis 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.Tag @Tagis a repeatable annotation that is used to declare a tag for the annotated test class or test method.Tags @Tagsis a container for one or more@Tagdeclarations.Test @Testis used to signal that the annotated method is a test method.TestFactory @TestFactoryis used to signal that the annotated method is a test factory method.TestInstance @TestInstanceis a type-level annotation that is used to configure the lifecycle of test instances for the annotated test class or test interface.TestMethodOrder @TestMethodOrderis a type-level annotation that is used to configure aMethodOrdererfor the test methods of the annotated test class or test interface.TestTemplate @TestTemplateis used to signal that the annotated method is a test template method.Timeout @Timeoutis used to define a timeout for a method or all testable methods within one class and its@Nestedclasses.