Skip to content

Commit

Permalink
Improve documentation for @EnabledIf and @DisabledIf test support
Browse files Browse the repository at this point in the history
Closes gh-28157
  • Loading branch information
sbrannen committed Mar 10, 2022
1 parent 1bbcd70 commit af977c0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
@@ -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.
Expand Down Expand Up @@ -50,12 +50,23 @@
* 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)
Expand Down
@@ -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.
Expand Down Expand Up @@ -50,11 +50,22 @@
* 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)
Expand Down
26 changes: 26 additions & 0 deletions src/docs/asciidoc/testing.adoc
Expand Up @@ -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`

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit af977c0

Please sign in to comment.