File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
src/test/java/org/testcontainers/containers Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,17 @@ dependencies {
66
77 testImplementation ' redis.clients:jedis:6.1.0'
88 testImplementation ' org.assertj:assertj-core:3.27.4'
9+ testImplementation platform(' org.junit:junit-bom:5.13.4' )
10+ testImplementation ' org.junit.jupiter:junit-jupiter'
11+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
912}
1013
1114tasks. japicmp {
1215 classExcludes = [
1316 " org.testcontainers.containers.ToxiproxyContainer"
1417 ]
1518}
19+
20+ tasks. withType(Test ). configureEach {
21+ useJUnitPlatform()
22+ }
Original file line number Diff line number Diff line change 33import eu .rekawek .toxiproxy .Proxy ;
44import eu .rekawek .toxiproxy .ToxiproxyClient ;
55import eu .rekawek .toxiproxy .model .ToxicDirection ;
6- import org .junit .Rule ;
7- import org .junit .Test ;
6+ import org .junit .jupiter .api .AutoClose ;
7+ import org .junit .jupiter .api .BeforeEach ;
8+ import org .junit .jupiter .api .Test ;
89import redis .clients .jedis .Jedis ;
910import redis .clients .jedis .exceptions .JedisConnectionException ;
1011
@@ -22,23 +23,29 @@ public class ToxiproxyTest {
2223 // spotless:off
2324 // creatingProxy {
2425 // Create a common docker network so that containers can communicate
25- @ Rule
26+ @ AutoClose
2627 public Network network = Network .newNetwork ();
2728
2829 // The target container - this could be anything
29- @ Rule
30+ @ AutoClose
3031 public GenericContainer <?> redis = new GenericContainer <>("redis:6-alpine" )
3132 .withExposedPorts (6379 )
3233 .withNetwork (network )
3334 .withNetworkAliases ("redis" );
3435
3536 // Toxiproxy container, which will be used as a TCP proxy
36- @ Rule
37+ @ AutoClose
3738 public ToxiproxyContainer toxiproxy = new ToxiproxyContainer ("ghcr.io/shopify/toxiproxy:2.5.0" )
3839 .withNetwork (network );
3940 // }
4041 // spotless:on
4142
43+ @ BeforeEach
44+ public void setUp () {
45+ redis .start ();
46+ toxiproxy .start ();
47+ }
48+
4249 @ Test
4350 public void testDirect () {
4451 final Jedis jedis = createJedis (redis .getHost (), redis .getFirstMappedPort ());
You can’t perform that action at this time.
0 commit comments