HHH-16497 Deprecate JUnit 4 testing annotations

This commit is contained in:
Yoann Rodière 2023-04-20 14:13:00 +02:00 committed by Christian Beikov
parent 9a9f027f82
commit a79b4df426
12 changed files with 41 additions and 0 deletions

View File

@ -17,8 +17,18 @@ import java.lang.annotation.Target;
* except this annotation need not be attached to a static method
*
* @author Steve Ebersole
* @deprecated Use JUnit 5 along with one of the Hibernate ORM's class-level test annotations
* ({@link org.hibernate.testing.orm.junit.BaseUnitTest},
* {@link org.hibernate.testing.orm.junit.SessionFactory},
* {@link org.hibernate.testing.orm.junit.Jpa},
* {@link org.hibernate.testing.orm.junit.SessionFactoryFunctionalTesting},
* {@link org.hibernate.testing.orm.junit.ServiceRegistryFunctionalTesting}, ...)
* and {@link org.junit.jupiter.api.AfterAll}.
* Alternatively to the Hibernate ORM test annotations,
* you can use {@code @TestInstance(TestInstance.Lifecycle.PER_CLASS)} directly on your test.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface AfterClassOnce {
}

View File

@ -17,8 +17,18 @@ import java.lang.annotation.Target;
* except this annotation need not be attached to a static method
*
* @author Steve Ebersole
* @deprecated Use JUnit 5 along with one of the Hibernate ORM's class-level test annotations
* ({@link org.hibernate.testing.orm.junit.BaseUnitTest},
* {@link org.hibernate.testing.orm.junit.SessionFactory},
* {@link org.hibernate.testing.orm.junit.Jpa},
* {@link org.hibernate.testing.orm.junit.SessionFactoryFunctionalTesting},
* {@link org.hibernate.testing.orm.junit.ServiceRegistryFunctionalTesting}, ...)
* and {@link org.junit.jupiter.api.BeforeAll}.
* Alternatively to the Hibernate ORM test annotations,
* you can use {@code @TestInstance(TestInstance.Lifecycle.PER_CLASS)} directly on your test.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface BeforeClassOnce {
}

View File

@ -16,9 +16,11 @@ import java.lang.annotation.Target;
*
* @author Hardy Ferentschik
* @author Steve Ebersole
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.FailureExpected} instead.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface FailureExpected {
String VALIDATE_FAILURE_EXPECTED = "hibernate.test.validatefailureexpected";

View File

@ -15,8 +15,10 @@ import java.lang.annotation.Target;
* Annotation used to identify a method as a callback to be executed whenever a {@link FailureExpected} is handled.
*
* @author Steve Ebersole
* @deprecated No replacement with JUnit 5 at the moment.
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
@Deprecated(forRemoval = true)
public @interface OnExpectedFailure {
}

View File

@ -15,8 +15,10 @@ import java.lang.annotation.Target;
* Annotation used to identify a method as a callback to be executed on test failures.
*
* @author Steve Ebersole
* @deprecated No replacement with JUnit 5 at the moment.
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD )
@Deprecated(forRemoval = true)
public @interface OnFailure {
}

View File

@ -21,10 +21,12 @@ import org.hibernate.dialect.Dialect;
* @see RequiresDialects
*
* @author Hardy Ferentschik
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.RequiresDialect} instead.
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(RequiresDialects.class)
@Deprecated(forRemoval = true)
public @interface RequiresDialect {
/**
* The dialects against which to run the test

View File

@ -16,9 +16,11 @@ import java.lang.annotation.Target;
* specified feature.
*
* @author Hardy Ferentschik
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.RequiresDialectFeature} instead.
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Deprecated(forRemoval = true)
public @interface RequiresDialectFeature {
/**
* @return Class which checks the necessary dialect feature

View File

@ -16,9 +16,11 @@ import java.lang.annotation.Target;
* Useful when test needs to be run against more than one dialect because of a different reason.
*
* @author Lukasz Antoniak
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.RequiresDialects} instead.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface RequiresDialects {
RequiresDialect[] value();
}

View File

@ -15,9 +15,12 @@ import java.lang.annotation.Target;
* An annotation, used in combination with {@link Matcher}, to determine when/if tests should be skipped.
*
* @author Steve Ebersole
* @deprecated Use JUnit 5 and {@link org.junit.jupiter.api.condition.DisabledOnOs}
* or {@link org.junit.jupiter.api.condition.DisabledIf}.
*/
@Retention( RetentionPolicy.RUNTIME )
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface Skip {
/**
* The condition which causes a skip

View File

@ -22,10 +22,12 @@ import org.hibernate.dialect.Dialect;
*
* @author Hardy Ferentschik
* @author Steve Ebersole
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.SkipForDialect} instead.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Repeatable(SkipForDialects.class)
@Deprecated(forRemoval = true)
public @interface SkipForDialect {
/**
* The dialects against which to skip the test

View File

@ -16,9 +16,11 @@ import java.lang.annotation.Target;
* Useful when more than one dialect needs to be skipped because of a different reason.
*
* @author Lukasz Antoniak
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.SkipForDialectGroup} instead.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface SkipForDialects {
SkipForDialect[] value();
}

View File

@ -15,9 +15,11 @@ import java.lang.annotation.Target;
* A documentation annotation for notating what JIRA issue is being tested.
*
* @author Steve Ebersole
* @deprecated Use {@link org.hibernate.testing.orm.junit.JiraKey} instead.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface TestForIssue {
/**
* The key of a JIRA issue tested.