Reputation: 1202
I have trait of wiremock like this:
trait WiremockSetup extends BeforeAndAfterAll { self: Suite =>
import WireMockConfiguration._
protected val wiremockServer = new WireMockServer(options().dynamicPort())
override protected def beforeAll(): Unit = {
super.beforeAll()
wiremockServer.start()
}
override protected def afterAll(): Unit = {
wiremockServer.stop()
super.afterAll()
}
}
And I mix the trait in my test class like this
class Foo extends FlatSpec with WiremockSetup{
"Test scneario" should "do something" in {
assert (1 == 1)
}
}
But I am seeing compilation problems like this:
An exception or error caused a run to abort.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory.buildHttpServer(JettyHttpServerFactory.java:63)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:76)
Why is problem?
Upvotes: 0
Views: 1567
Reputation:
Make sure you have this dependency:
"com.github.tomakehurst" % "wiremock-jre8" % "2.22.0"
Upvotes: 2