@Test
to Jupiter's.
To emphasize its character as a temporary solution and to reduce risk of accidental use, it's marked as deprecated.
Deprecated since v0.4; not intended to be removed.@Deprecated
@Target(value={ANNOTATION_TYPE,METHOD})
@Retention(value=RUNTIME)
@ExtendWith(value=org.junitpioneer.vintage.ExpectedExceptionExtension.class) @ExtendWith(value=org.junitpioneer.vintage.TimeoutExtension.class)
@Test
public @interface Test
@Test
is used to signal to JUnit Jupiter that the annotated method is a test method - it is
a drop-in replacement for JUnit 4's @Test
.
Like JUnit 4's annotation it offers the possibility to expect exceptions
and to
time out
long running tests.
Also check
Jupiter's @Test
for more information regarding JUnit Jupiter integration and
Pioneer's documentation on this @Test
for more details and examples.
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<? extends java.lang.Throwable> |
expected
Deprecated.
Optionally specify
expected , a Throwable, to cause a test method to succeed if
and only if an exception of the specified class is thrown by the method. |
long |
timeout
Deprecated.
Optionally specify
timeout in milliseconds to cause a test method to fail if it
takes longer than that number of milliseconds. |
public abstract java.lang.Class<? extends java.lang.Throwable> expected
expected
, a Throwable, to cause a test method to succeed if
and only if an exception of the specified class is thrown by the method.public abstract long timeout
timeout
in milliseconds to cause a test method to fail if it
takes longer than that number of milliseconds.
If the timeout is exceeded, the test will be abandoned (i.e. the test execution moves on to the next test) and the thread running it is interrupted.
In accordance with JUnit 4, the default value is 0
, which means that while
configuring 0 milliseconds is possible, it is indistinguishable from the default value
and thus ignored. Negative values are rejected with an exception.