Rename OK to NO_CONTENT as the value is 204, not 200
Change-Id: I93e74a69a84f07f52935ceecef9c172e7c1c80dc
diff --git a/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpResponseHandlerTest.java b/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpResponseHandlerTest.java
index b612770..ee8f9b4 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpResponseHandlerTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpResponseHandlerTest.java
@@ -30,7 +30,7 @@
public class HttpResponseHandlerTest {
private static final int ERROR = 400;
- private static final int OK = 204;
+ private static final int NO_CONTENT = 204;
private static final String EMPTY_ENTITY = "";
private static final String ERROR_ENTITY = "Error";
@@ -43,7 +43,7 @@
@Test
public void testIsSuccessful() throws Exception {
- HttpResponse response = setupMocks(OK, EMPTY_ENTITY);
+ HttpResponse response = setupMocks(NO_CONTENT, EMPTY_ENTITY);
HttpResult result = handler.handleResponse(response);
assertThat(result.isSuccessful()).isTrue();
assertThat(result.getMessage()).isEmpty();
diff --git a/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpSessionTest.java b/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpSessionTest.java
index 69a188c..7834cf0 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpSessionTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/highavailability/forwarder/rest/HttpSessionTest.java
@@ -41,7 +41,7 @@
private static final int RETRY_INTERVAL = 250;
private static final int TIMEOUT = 500;
private static final int ERROR = 500;
- private static final int OK = 204;
+ private static final int NO_CONTENT = 204;
private static final int NOT_FOUND = 404;
private static final int UNAUTHORIZED = 401;
@@ -80,7 +80,7 @@
@Test
public void testPostResponseOK() throws Exception {
wireMockRule.givenThat(post(urlEqualTo(ENDPOINT))
- .willReturn(aResponse().withStatus(OK)));
+ .willReturn(aResponse().withStatus(NO_CONTENT)));
assertThat(httpSession.post(ENDPOINT).isSuccessful()).isTrue();
}
@@ -88,14 +88,14 @@
@Test
public void testPostResponseWithContentOK() throws Exception {
wireMockRule.givenThat(post(urlEqualTo(ENDPOINT))
- .withRequestBody(equalTo(BODY)).willReturn(aResponse().withStatus(OK)));
+ .withRequestBody(equalTo(BODY)).willReturn(aResponse().withStatus(NO_CONTENT)));
assertThat(httpSession.post(ENDPOINT, BODY).isSuccessful()).isTrue();
}
@Test
public void testDeleteResponseOK() throws Exception {
wireMockRule.givenThat(delete(urlEqualTo(ENDPOINT))
- .willReturn(aResponse().withStatus(OK)));
+ .willReturn(aResponse().withStatus(NO_CONTENT)));
assertThat(httpSession.delete(ENDPOINT).isSuccessful()).isTrue();
}
@@ -129,7 +129,7 @@
.willReturn(aResponse().withStatus(ERROR)));
wireMockRule.givenThat(post(urlEqualTo(ENDPOINT)).inScenario(RETRY_AT_ERROR)
.whenScenarioStateIs(REQUEST_MADE)
- .willReturn(aResponse().withStatus(OK)));
+ .willReturn(aResponse().withStatus(NO_CONTENT)));
assertThat(httpSession.post(ENDPOINT).isSuccessful()).isTrue();
}
@@ -151,7 +151,7 @@
.willReturn(aResponse().withStatus(ERROR).withFixedDelay(TIMEOUT / 2)));
wireMockRule.givenThat(post(urlEqualTo(ENDPOINT)).inScenario(RETRY_AT_DELAY)
.whenScenarioStateIs(REQUEST_MADE)
- .willReturn(aResponse().withStatus(OK)));
+ .willReturn(aResponse().withStatus(NO_CONTENT)));
assertThat(httpSession.post(ENDPOINT).isSuccessful()).isTrue();
}
@@ -169,7 +169,7 @@
.willReturn(aResponse().withFixedDelay(TIMEOUT)));
wireMockRule.givenThat(post(urlEqualTo(ENDPOINT)).inScenario(RETRY_AT_DELAY)
.whenScenarioStateIs(THIRD_TRY)
- .willReturn(aResponse().withStatus(OK)));
+ .willReturn(aResponse().withStatus(NO_CONTENT)));
assertThat(httpSession.post(ENDPOINT).isSuccessful()).isTrue();
}