Skip to content

Commit 1d15a04

Browse files
committed
Simplify extensions class names concatenation
1 parent c88910c commit 1d15a04

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@
146146
<version>0.4.1</version>
147147
<classifier>jar-with-dependencies</classifier>
148148
</artifactItem>
149+
<dependency>
150+
<groupId>org.wiremock</groupId>
151+
<artifactId>wiremock-webhooks-extension</artifactId>
152+
<version>2.35.0</version>
153+
</dependency>
149154
</artifactItems>
150155
<outputDirectory>${project.build.directory}/test-wiremock-extension</outputDirectory>
151156
</configuration>

src/main/java/org/wiremock/integrations/testcontainers/WireMockContainer.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,7 @@ protected void configure() {
211211
}
212212
if (!extensionClassNames.isEmpty()) {
213213
wireMockArgs.append(" --extensions ");
214-
int counter = 0;
215-
for (String className : extensionClassNames) {
216-
wireMockArgs.append(className);
217-
wireMockArgs.append( (++counter != extensionClassNames.size()) ? ',' : ' ');
218-
}
214+
wireMockArgs.append(String.join(",", extensionClassNames));
219215
}
220216

221217
// Add CLI arguments

src/test/java/org/wiremock/integrations/testcontainers/WireMockContainerExtensionTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public class WireMockContainerExtensionTest {
4343
public WireMockContainer wiremockServer = new WireMockContainer("2.35.0")
4444
.withStartupTimeout(Duration.ofSeconds(60))
4545
.withMapping("json-body-transformer", WireMockContainerExtensionTest.class, "json-body-transformer.json")
46-
.withExtension("JSON Body Transformer", Collections.singleton("com.ninecookies.wiremock.extensions.JsonBodyTransformer"),
46+
.withExtension("Webhook",
47+
Collections.singleton("org.wiremock.webhooks.Webhooks"),
48+
Collections.singleton(Paths.get("target", "test-wiremock-extension", "wiremock-webhooks-extension-2.35.0.jar").toFile()))
49+
.withExtension("JSON Body Transformer",
50+
Collections.singleton("com.ninecookies.wiremock.extensions.JsonBodyTransformer"),
4751
Collections.singleton(Paths.get("target", "test-wiremock-extension", "wiremock-extensions-0.4.1-jar-with-dependencies.jar").toFile()));
4852

4953
@Before

0 commit comments

Comments
 (0)