|
| 1 | +/* Hibernate, Relational Persistence for Idiomatic Java |
| 2 | + * |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * Copyright: Red Hat Inc. and Hibernate Authors |
| 5 | + */ |
| 6 | +package org.hibernate.reactive.annotations; |
| 7 | + |
| 8 | +import java.lang.annotation.ElementType; |
| 9 | +import java.lang.annotation.Inherited; |
| 10 | +import java.lang.annotation.Repeatable; |
| 11 | +import java.lang.annotation.Retention; |
| 12 | +import java.lang.annotation.RetentionPolicy; |
| 13 | +import java.lang.annotation.Target; |
| 14 | + |
| 15 | +import org.hibernate.reactive.containers.DatabaseConfiguration; |
| 16 | + |
| 17 | +import org.junit.jupiter.api.extension.ExtendWith; |
| 18 | + |
| 19 | +/** |
| 20 | + * Annotation that allows disabling tests or test methods for specific database types. |
| 21 | + * <p> |
| 22 | + * Types are defined in {@link DatabaseConfiguration.DBType} and can be |
| 23 | + * applied to a test class or a test method |
| 24 | + * |
| 25 | + * <pre>{@code |
| 26 | + * |
| 27 | + * @DisableFor( value = MYSQL, reason = "Reason #1") |
| 28 | + * public class DisableDBForClassTest { |
| 29 | + * |
| 30 | + * @Test |
| 31 | + * public void test(VertxTestContext context) { |
| 32 | + * .... |
| 33 | + * } |
| 34 | + * } |
| 35 | + * |
| 36 | + * public class DisableDBForMethodTest { |
| 37 | + * |
| 38 | + * @Test |
| 39 | + * @DisableFor( value = POSTGRES, reason = "Reason #2") |
| 40 | + * public void test(VertxTestContext context) { |
| 41 | + * .... |
| 42 | + * } |
| 43 | + * } |
| 44 | + * }</pre> |
| 45 | + * |
| 46 | + */ |
| 47 | + |
| 48 | +@SuppressWarnings("JavadocReference") |
| 49 | +@Inherited |
| 50 | +@Retention( RetentionPolicy.RUNTIME ) |
| 51 | +@Target({ ElementType.TYPE, ElementType.METHOD}) |
| 52 | +@Repeatable( DisableForGroup.class ) |
| 53 | +@ExtendWith( DisableForDBTypeCondition.class ) |
| 54 | +public @interface DisableFor { |
| 55 | + DatabaseConfiguration.DBType value(); |
| 56 | + String reason() default "<undefined>"; |
| 57 | +} |
0 commit comments