0
http 요청/응답을 테스트하고 싶습니다. 그래서 WireMock을 사용합니다.WireMock : 스터 빙 - 오브젝트 "testClient"를 얻는 방법은 무엇입니까?
나는 특정 요청에 대한 응답을 스텁하려면 : 다음 코드 :
public class WireMockPersons {
@Rule
public WireMockRule wireMockRule = new WireMockRule(8089);
@Test
public void exactUrlOnly() {
stubFor(get(urlEqualTo("/some/thing"))
.willReturn(aResponse()
.withHeader("Content-Type", "text/plain")
.withBody("Hello world!")));
assertThat(testClient.get("/some/thing").statusCode(), is(200));
assertThat(testClient.get("/some/thing/else").statusCode(), is(404));
}
코드는 컴파일되지 아니 객체 TestClient을 때문이다. 어떻게 testClient 개체를 얻을 수 있습니까?