Reputation: 14652
I'm trying examples of stubbing in my project, and having error: Cannot resolve method 'willReturn' in 'Object'
This is one of the examples:
@Test
public void exactUrlOnly() {
stubFor(get(urlEqualTo("/some/thing"))
.willReturn(aResponse()
.withHeader("Content-Type", "text/plain")
.withBody("Hello world!")));
}
If I compile the project will have this error:
java: cannot find symbol
symbol: method willReturn(com.github.tomakehurst.wiremock.http.ResponseDefinition)
location: class java.lang.Object
Anyone know how to fix it?
Upvotes: 1
Views: 870
Reputation: 14652
Found the reason, Intellij autocompleted the import when I was typing get
:
import static javax.swing.UIManager.get;
which should be
import static com.github.tomakehurst.wiremock.client.WireMock.get;
Upvotes: 2