Skip to content

Commit 9468510

Browse files
committed
feat: add @ManagedNetwork to /junit-jupiter
This enables Testcontainers to manage the network in JUnit Jupiter tests. With JUnit4, the users had something like @ClassRule Network ... The new annotation enables @ManagedNetwor Network code with JUnit 5
1 parent aae4f64 commit 9468510

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.testcontainers.junit.jupiter;
2+
3+
import org.junit.jupiter.api.AutoClose;
4+
5+
import java.lang.annotation.ElementType;
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
import java.lang.annotation.Target;
9+
10+
/**
11+
* The {@code @Network} annotation is used in conjunction with the {@link Testcontainers} annotation
12+
* to mark networks that should be managed by the Testcontainers extension.
13+
*
14+
* @see Testcontainers
15+
*/
16+
@Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE })
17+
@Retention(RetentionPolicy.RUNTIME)
18+
@AutoClose
19+
public @interface ManagedNetwork {
20+
}

0 commit comments

Comments
 (0)