Annotation Type Test


  • @Deprecated
    @Target({ANNOTATION_TYPE,METHOD})
    @Retention(RUNTIME)
    @ExtendWith(ExpectedExceptionExtension.class) @ExtendWith(TimeoutExtension.class)
    @Test
    public @interface Test
    Deprecated.
    This annotation is an intermediate step on a full migration from JUnit 4's @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.
    @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.

    Since:
    0.1
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element 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.
    • Element Detail

      • expected

        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.
        Default:
        org.junitpioneer.vintage.Test.None.class
      • timeout

        long timeout
        Deprecated.
        Optionally specify 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.

        Default:
        0L