Browse Source

Merge branch '5.3.x'

pull/28170/head
Sam Brannen 3 years ago
parent
commit
0e7c7b444c
  1. 13
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java
  2. 13
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java
  3. 26
      src/docs/asciidoc/testing.adoc

13
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIf.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -50,12 +50,23 @@ import org.springframework.core.annotation.AliasFor; @@ -50,12 +50,23 @@ import org.springframework.core.annotation.AliasFor;
* public {@literal @}interface DisabledOnMac {}
* </pre>
*
* <p>Please note that {@code @DisabledOnMac} is meant only as an example of what
* is possible. If you have that exact use case, please use the built-in
* {@link org.junit.jupiter.api.condition.DisabledOnOs @DisabledOnOs(MAC)} support
* in JUnit Jupiter.
*
* <p>Since JUnit 5.7, JUnit Jupiter also has a condition annotation named
* {@link org.junit.jupiter.api.condition.DisabledIf @DisabledIf}. Thus, if you
* wish to use Spring's {@code @DisabledIf} support make sure you import the
* annotation type from the correct package.
*
* @author Sam Brannen
* @author Tadaya Tsuyukubo
* @since 5.0
* @see SpringExtension
* @see EnabledIf
* @see org.junit.jupiter.api.Disabled
* @see org.junit.jupiter.api.condition.DisabledIf
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)

13
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/EnabledIf.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -50,11 +50,22 @@ import org.springframework.core.annotation.AliasFor; @@ -50,11 +50,22 @@ import org.springframework.core.annotation.AliasFor;
* public {@literal @}interface EnabledOnMac {}
* </pre>
*
* <p>Please note that {@code @EnabledOnMac} is meant only as an example of what
* is possible. If you have that exact use case, please use the built-in
* {@link org.junit.jupiter.api.condition.EnabledOnOs @EnabledOnOs(MAC)} support
* in JUnit Jupiter.
*
* <p>Since JUnit 5.7, JUnit Jupiter also has a condition annotation named
* {@link org.junit.jupiter.api.condition.EnabledIf @EnabledIf}. Thus, if you
* wish to use Spring's {@code @EnabledIf} support make sure you import the
* annotation type from the correct package.
*
* @author Sam Brannen
* @since 5.0
* @see SpringExtension
* @see DisabledIf
* @see org.junit.jupiter.api.Disabled
* @see org.junit.jupiter.api.condition.EnabledIf
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)

26
src/docs/asciidoc/testing.adoc

@ -1960,6 +1960,19 @@ example, you can create a custom `@EnabledOnMac` annotation as follows: @@ -1960,6 +1960,19 @@ example, you can create a custom `@EnabledOnMac` annotation as follows:
annotation class EnabledOnMac {}
----
[NOTE]
====
`@EnabledOnMac` is meant only as an example of what is possible. If you have that exact
use case, please use the built-in `@EnabledOnOs(MAC)` support in JUnit Jupiter.
====
[WARNING]
====
Since JUnit 5.7, JUnit Jupiter also has a condition annotation named `@EnabledIf`. Thus,
if you wish to use Spring's `@EnabledIf` support make sure you import the annotation type
from the correct package.
====
[[integration-testing-annotations-junit-jupiter-disabledif]]
===== `@DisabledIf`
@ -2008,6 +2021,19 @@ example, you can create a custom `@DisabledOnMac` annotation as follows: @@ -2008,6 +2021,19 @@ example, you can create a custom `@DisabledOnMac` annotation as follows:
annotation class DisabledOnMac {}
----
[NOTE]
====
`@DisabledOnMac` is meant only as an example of what is possible. If you have that exact
use case, please use the built-in `@DisabledOnOs(MAC)` support in JUnit Jupiter.
====
[WARNING]
====
Since JUnit 5.7, JUnit Jupiter also has a condition annotation named `@DisabledIf`. Thus,
if you wish to use Spring's `@DisabledIf` support make sure you import the annotation type
from the correct package.
====
[[integration-testing-annotations-meta]]
==== Meta-Annotation Support for Testing

Loading…
Cancel
Save