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 * except this annotation need not be attached to a static method
* *
* @author Steve Ebersole * @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) @Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface AfterClassOnce { 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 * except this annotation need not be attached to a static method
* *
* @author Steve Ebersole * @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) @Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface BeforeClassOnce { public @interface BeforeClassOnce {
} }

View File

@ -16,9 +16,11 @@ import java.lang.annotation.Target;
* *
* @author Hardy Ferentschik * @author Hardy Ferentschik
* @author Steve Ebersole * @author Steve Ebersole
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.FailureExpected} instead.
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface FailureExpected { public @interface FailureExpected {
String VALIDATE_FAILURE_EXPECTED = "hibernate.test.validatefailureexpected"; 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. * Annotation used to identify a method as a callback to be executed whenever a {@link FailureExpected} is handled.
* *
* @author Steve Ebersole * @author Steve Ebersole
* @deprecated No replacement with JUnit 5 at the moment.
*/ */
@Retention( RetentionPolicy.RUNTIME ) @Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD ) @Target( ElementType.METHOD )
@Deprecated(forRemoval = true)
public @interface OnExpectedFailure { 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. * Annotation used to identify a method as a callback to be executed on test failures.
* *
* @author Steve Ebersole * @author Steve Ebersole
* @deprecated No replacement with JUnit 5 at the moment.
*/ */
@Retention( RetentionPolicy.RUNTIME ) @Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.METHOD ) @Target( ElementType.METHOD )
@Deprecated(forRemoval = true)
public @interface OnFailure { public @interface OnFailure {
} }

View File

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

View File

@ -16,9 +16,11 @@ import java.lang.annotation.Target;
* specified feature. * specified feature.
* *
* @author Hardy Ferentschik * @author Hardy Ferentschik
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.RequiresDialectFeature} instead.
*/ */
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Deprecated(forRemoval = true)
public @interface RequiresDialectFeature { public @interface RequiresDialectFeature {
/** /**
* @return Class which checks the necessary dialect feature * @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. * Useful when test needs to be run against more than one dialect because of a different reason.
* *
* @author Lukasz Antoniak * @author Lukasz Antoniak
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.RequiresDialects} instead.
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface RequiresDialects { public @interface RequiresDialects {
RequiresDialect[] value(); 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. * An annotation, used in combination with {@link Matcher}, to determine when/if tests should be skipped.
* *
* @author Steve Ebersole * @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 ) @Retention( RetentionPolicy.RUNTIME )
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface Skip { public @interface Skip {
/** /**
* The condition which causes a skip * The condition which causes a skip

View File

@ -22,10 +22,12 @@ import org.hibernate.dialect.Dialect;
* *
* @author Hardy Ferentschik * @author Hardy Ferentschik
* @author Steve Ebersole * @author Steve Ebersole
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.SkipForDialect} instead.
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Repeatable(SkipForDialects.class) @Repeatable(SkipForDialects.class)
@Deprecated(forRemoval = true)
public @interface SkipForDialect { public @interface SkipForDialect {
/** /**
* The dialects against which to skip the test * 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. * Useful when more than one dialect needs to be skipped because of a different reason.
* *
* @author Lukasz Antoniak * @author Lukasz Antoniak
* @deprecated Use JUnit 5 and {@link org.hibernate.testing.orm.junit.SkipForDialectGroup} instead.
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE }) @Target({ ElementType.METHOD, ElementType.TYPE })
@Deprecated(forRemoval = true)
public @interface SkipForDialects { public @interface SkipForDialects {
SkipForDialect[] value(); SkipForDialect[] value();
} }

View File

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