Andi
01/17/2025, 2:44 PMimport static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import com.github.tomakehurst.wiremock.WireMockServer;
public class WireMockStandaloneTest {
public static void main(String[] args) {
WireMockServer wireMockServer = new WireMockServer(wireMockConfig().port(8080));
wireMockServer.start();
System.out.println("WireMockServer started on port: " + wireMockServer.port());
wireMockServer.stop();
}
}
When I run the "app" I receive this error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:385)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at com.github.tomakehurst.wiremock.http.HttpServerFactoryLoader.pickMostAppropriateFrom(HttpServerFactoryLoader.java:77)
at com.github.tomakehurst.wiremock.http.HttpServerFactoryLoader.load(HttpServerFactoryLoader.java:57)
at com.github.tomakehurst.wiremock.WireMockServer.getHttpServerFactory(WireMockServer.java:89)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:72)
at com.juliusbaer.age.brsave.WireMockStandaloneTest.main(WireMockStandaloneTest.java:9)
The maven dependency I am using:
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-jetty12</artifactId>
<version>3.10.0</version>
<scope>test</scope> </dependency>