Skip to content

Commit a677857

Browse files
Matthias MerdesMatthias Merdes
authored andcommitted
#63: added API-annotations for junit5-api
1 parent 54e8620 commit a677857

37 files changed

+186
-0
lines changed

junit5-api/src/main/java/org/junit/gen5/api/AfterAll.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Maintained;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @AfterAll} is used to signal that the annotated method should be
2125
* executed <em>after</em> <strong>all</strong> tests in the current test
@@ -41,5 +45,6 @@
4145
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
4246
@Retention(RetentionPolicy.RUNTIME)
4347
@Documented
48+
@API(Maintained)
4449
public @interface AfterAll {
4550
}

junit5-api/src/main/java/org/junit/gen5/api/AfterEach.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Stable;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @AfterEach} is used to signal that the annotated method should be
2125
* executed <em>after</em> <strong>each</strong> {@code @Test} method in
@@ -40,5 +44,6 @@
4044
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
4145
@Retention(RetentionPolicy.RUNTIME)
4246
@Documented
47+
@API(Stable)
4348
public @interface AfterEach {
4449
}

junit5-api/src/main/java/org/junit/gen5/api/Assertions.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Experimental;
14+
import static org.junit.gen5.commons.meta.API.Usage.Maintained;
15+
1316
import java.util.Objects;
1417
import java.util.function.BooleanSupplier;
1518
import java.util.function.Supplier;
1619

20+
import org.junit.gen5.commons.meta.API;
1721
import org.junit.gen5.commons.util.ExceptionUtils;
1822
import org.junit.gen5.commons.util.StringUtils;
1923
import org.opentest4j.AssertionFailedError;
@@ -28,6 +32,7 @@
2832
* @see AssertionFailedError
2933
* @see Assumptions
3034
*/
35+
@API(Maintained)
3136
public final class Assertions {
3237

3338
private Assertions() {
@@ -318,6 +323,7 @@ public static void assertNotSame(Object unexpected, Object actual, Supplier<Stri
318323
* Asserts that <em>all</em> assertions contained in {@code asserts} do not fail.
319324
* Report a failure of at least one in a {@link MultipleFailuresError}.
320325
*/
326+
@API(Experimental)
321327
public static void assertAll(Executable... asserts) throws MultipleFailuresError {
322328
assertAll(null, asserts);
323329
}
@@ -328,6 +334,7 @@ public static void assertAll(Executable... asserts) throws MultipleFailuresError
328334
*
329335
* <p>Include {@code heading} in the exception's message string.</p>
330336
*/
337+
@API(Experimental)
331338
public static void assertAll(String heading, Executable... asserts) throws MultipleFailuresError {
332339
MultipleFailuresError multipleFailuresError = new MultipleFailuresError(heading);
333340
for (Executable executable : asserts) {

junit5-api/src/main/java/org/junit/gen5/api/Assumptions.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Experimental;
14+
import static org.junit.gen5.commons.meta.API.Usage.Maintained;
15+
1316
import java.util.function.BooleanSupplier;
1417
import java.util.function.Supplier;
1518

19+
import org.junit.gen5.commons.meta.API;
1620
import org.junit.gen5.commons.util.ExceptionUtils;
1721
import org.junit.gen5.commons.util.StringUtils;
1822
import org.opentest4j.TestAbortedException;
@@ -34,6 +38,7 @@
3438
* @see TestAbortedException
3539
* @see Assertions
3640
*/
41+
@API(Maintained)
3742
public final class Assumptions {
3843

3944
private Assumptions() {
@@ -204,6 +209,7 @@ public static void assumeFalse(BooleanSupplier assumptionSupplier, Supplier<Stri
204209
* @param executable the block of code to execute if the assumption is valid
205210
* @see #assumingThat(boolean, Executable)
206211
*/
212+
@API(Experimental)
207213
public static void assumingThat(BooleanSupplier assumptionSupplier, Executable executable) {
208214
assumingThat(assumptionSupplier.getAsBoolean(), executable);
209215
}
@@ -222,6 +228,7 @@ public static void assumingThat(BooleanSupplier assumptionSupplier, Executable e
222228
* @param executable the block of code to execute if the assumption is valid
223229
* @see #assumingThat(BooleanSupplier, Executable)
224230
*/
231+
@API(Experimental)
225232
public static void assumingThat(boolean assumption, Executable executable) {
226233
if (assumption) {
227234
try {

junit5-api/src/main/java/org/junit/gen5/api/BeforeAll.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Maintained;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @BeforeAll} is used to signal that the annotated method should be
2125
* executed <em>before</em> <strong>all</strong> tests in the current test
@@ -41,5 +45,6 @@
4145
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
4246
@Retention(RetentionPolicy.RUNTIME)
4347
@Documented
48+
@API(Maintained)
4449
public @interface BeforeAll {
4550
}

junit5-api/src/main/java/org/junit/gen5/api/BeforeEach.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Stable;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @BeforeEach} is used to signal that the annotated method should be
2125
* executed <em>before</em> <strong>each</strong> {@code @Test} method in
@@ -40,5 +44,6 @@
4044
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
4145
@Retention(RetentionPolicy.RUNTIME)
4246
@Documented
47+
@API(Stable)
4348
public @interface BeforeEach {
4449
}

junit5-api/src/main/java/org/junit/gen5/api/Disabled.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Stable;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @Disabled} is used to signal that the annotated test class or
2125
* test method is currently <em>disabled</em> and should not be executed.
@@ -28,6 +32,7 @@
2832
@Target({ ElementType.TYPE, ElementType.METHOD })
2933
@Retention(RetentionPolicy.RUNTIME)
3034
@Documented
35+
@API(Stable)
3136
public @interface Disabled {
3237

3338
/**

junit5-api/src/main/java/org/junit/gen5/api/DisplayName.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Experimental;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @DisplayName} is used to declare a custom display name for the
2125
* annotated test class or test method.
@@ -30,6 +34,7 @@
3034
@Target({ ElementType.TYPE, ElementType.METHOD })
3135
@Retention(RetentionPolicy.RUNTIME)
3236
@Documented
37+
@API(Experimental)
3338
public @interface DisplayName {
3439

3540
String value();

junit5-api/src/main/java/org/junit/gen5/api/Executable.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Stable;
14+
15+
import org.junit.gen5.commons.meta.API;
16+
1317
/**
1418
* {@code Executable} is a functional interface that can be used to
1519
* implement any generic block of code that potentially throws a
@@ -34,6 +38,7 @@
3438
* @see Assumptions#assumingThat(java.util.function.BooleanSupplier, Executable)
3539
*/
3640
@FunctionalInterface
41+
@API(Stable)
3742
public interface Executable {
3843

3944
void execute() throws Throwable;

junit5-api/src/main/java/org/junit/gen5/api/Nested.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
package org.junit.gen5.api;
1212

13+
import static org.junit.gen5.commons.meta.API.Usage.Experimental;
14+
1315
import java.lang.annotation.Documented;
1416
import java.lang.annotation.ElementType;
1517
import java.lang.annotation.Retention;
1618
import java.lang.annotation.RetentionPolicy;
1719
import java.lang.annotation.Target;
1820

21+
import org.junit.gen5.commons.meta.API;
22+
1923
/**
2024
* {@code @Nested} is used to signal that the annotated class is a nested,
2125
* non-static test class.
@@ -25,5 +29,6 @@
2529
@Target(ElementType.TYPE)
2630
@Retention(RetentionPolicy.RUNTIME)
2731
@Documented
32+
@API(Experimental)
2833
public @interface Nested {
2934
}

0 commit comments

Comments
 (0)