11package org .testcontainers .junit ;
22
33import com .google .common .collect .ImmutableSet ;
4+ import org .assertj .core .api .Assumptions ;
5+ import org .junit .Before ;
46import org .junit .Test ;
57import org .junit .runner .RunWith ;
68import org .junit .runners .Parameterized ;
79import org .testcontainers .containers .ComposeContainer ;
10+ import org .testcontainers .utility .CommandLine ;
811
912import java .io .File ;
1013import java .util .Set ;
@@ -19,19 +22,19 @@ public class ComposeContainerWithOptionsTest {
1922
2023 public ComposeContainerWithOptionsTest (
2124 final File composeFile ,
22- final boolean local ,
25+ final boolean localMode ,
2326 final Set <String > options ,
2427 final boolean expectError
2528 ) {
2629 this .composeFile = composeFile ;
27- this .local = local ;
30+ this .localMode = localMode ;
2831 this .options = options ;
2932 this .expectError = expectError ;
3033 }
3134
3235 private final File composeFile ;
3336
34- private final boolean local ;
37+ private final boolean localMode ;
3538
3639 private final Set <String > options ;
3740
@@ -73,12 +76,22 @@ public static Object[][] params() {
7376 };
7477 }
7578
79+ @ Before
80+ public void setUp () {
81+ if (this .localMode ) {
82+ Assumptions
83+ .assumeThat (CommandLine .executableExists (ComposeContainer .COMPOSE_EXECUTABLE ))
84+ .as ("docker executable exists" )
85+ .isTrue ();
86+ }
87+ }
88+
7689 @ Test
7790 public void performTest () {
7891 try (
7992 ComposeContainer environment = new ComposeContainer (composeFile )
8093 .withOptions (options .stream ().toArray (String []::new ))
81- .withLocalCompose (local )
94+ .withLocalCompose (localMode )
8295 ) {
8396 environment .start ();
8497 assertThat (expectError ).isFalse ();
0 commit comments