diff --git a/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMock.java b/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMock.java index 3f8b3a2..1da535e 100644 --- a/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMock.java +++ b/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMock.java @@ -69,6 +69,7 @@ public HttpClientMock(String defaultHost) { */ public void reset() { this.rulesUnderConstruction.clear(); + this.rules.clear(); this.requests.clear(); } diff --git a/src/test/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilderTest.java b/src/test/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilderTest.java index 006982c..0af4134 100644 --- a/src/test/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilderTest.java +++ b/src/test/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilderTest.java @@ -276,7 +276,18 @@ public void after_reset_every_call_should_result_in_status_404() throws IOExcept httpClientMock.onPost("/login").doReturnStatus(200); httpClientMock.reset(); + HttpResponse login = httpClientMock.execute(new HttpPost("http://localhost/login")); + + assertThat(login, hasStatus(404)); + } + + @Test + public void after_execute_and_reset_every_call_should_result_in_status_404() throws IOException { + HttpClientMock httpClientMock = new HttpClientMock("http://localhost"); + httpClientMock.onPost("/login").doReturnStatus(200); + httpClientMock.execute(new HttpPost("http://localhost/login")); + httpClientMock.reset(); HttpResponse login = httpClientMock.execute(new HttpPost("http://localhost/login")); assertThat(login, hasStatus(404));