File tree 2 files changed +22
-0
lines changed
main/java/org/testcontainers/utility
test/java/org/testcontainers/utility
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ protected String getDescription() {
155
155
configuredInstance .getDescription ()
156
156
);
157
157
}
158
+
159
+ @ Override
160
+ public String toString () {
161
+ return getDescription ();
162
+ }
158
163
}
159
164
160
165
private static class NoopImageNameSubstitutor extends ImageNameSubstitutor {
Original file line number Diff line number Diff line change 5
5
import org .junit .Rule ;
6
6
import org .junit .Test ;
7
7
import org .mockito .Mockito ;
8
+ import org .testcontainers .containers .GenericContainer ;
8
9
9
10
import static org .assertj .core .api .Assertions .assertThat ;
11
+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
10
12
import static org .mockito .ArgumentMatchers .eq ;
11
13
12
14
public class ImageNameSubstitutorTest {
@@ -64,4 +66,19 @@ public void testWorksWithoutConfiguredImplementation() {
64
66
.as ("the image has been substituted by default then configured implementations" )
65
67
.isEqualTo ("substituted-image:latest" );
66
68
}
69
+
70
+ @ Test
71
+ public void testImageNameSubstitutorToString () {
72
+ Mockito
73
+ .doReturn (FakeImageSubstitutor .class .getCanonicalName ())
74
+ .when (TestcontainersConfiguration .getInstance ())
75
+ .getImageSubstitutorClassName ();
76
+
77
+ try (GenericContainer <?> container = new GenericContainer <>(DockerImageName .parse ("original" ))) {
78
+ assertThatThrownBy (container ::start )
79
+ .hasMessageContaining (
80
+ "imageNameSubstitutor=Chained substitutor of 'default implementation' and then 'test implementation'"
81
+ );
82
+ }
83
+ }
67
84
}
You can’t perform that action at this time.
0 commit comments