Skip to content

Commit f7110ac

Browse files
committed
Fix method name 'getResponseBodyAsString'
1 parent 84980e9 commit f7110ac

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/java/org/maproulette/client/connection/MapRouletteConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Optional<String> execute(final Query query) throws MapRouletteException
7171
{
7272
case HttpStatus.SC_OK:
7373
case HttpStatus.SC_CREATED:
74-
final String ret = resource.getRequestBodyAsString();
74+
final String ret = resource.getResponseBodyAsString();
7575
log.trace("Response body: {}", ret);
7676
return ret;
7777
case HttpStatus.SC_NO_CONTENT:
@@ -80,7 +80,7 @@ public Optional<String> execute(final Query query) throws MapRouletteException
8080
default:
8181
throw new MapRouletteException(
8282
String.format("Invalid response status code %d - %s",
83-
statusCode, resource.getRequestBodyAsString()));
83+
statusCode, resource.getResponseBodyAsString()));
8484
}
8585
}));
8686
}

src/main/java/org/maproulette/client/http/HttpResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public Header[] getHeader(final String headerKey) throws MapRouletteException
9595
return this.response.getHeaders(headerKey);
9696
}
9797

98-
public String getRequestBodyAsString() throws MapRouletteException
98+
public String getResponseBodyAsString() throws MapRouletteException
9999
{
100100
try
101101
{

src/test/java/org/maproulette/client/connection/MapRouletteConnectionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void deleteTest() throws MapRouletteException
6262
when(deleteResource.getStatusCode()).thenReturn(HttpStatus.SC_NOT_FOUND)
6363
.thenReturn(HttpStatus.SC_NO_CONTENT).thenReturn(HttpStatus.SC_OK)
6464
.thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
65-
when(deleteResource.getRequestBodyAsString()).thenReturn("test");
65+
when(deleteResource.getResponseBodyAsString()).thenReturn("test");
6666
final var query = Query.builder().delete("").build();
6767
Assertions.assertTrue(connection.execute(query).isEmpty());
6868
Assertions.assertTrue(connection.execute(query).isEmpty());
@@ -80,7 +80,7 @@ public void retrieveTest() throws MapRouletteException
8080
when(getResource.getStatusCode()).thenReturn(HttpStatus.SC_NOT_FOUND)
8181
.thenReturn(HttpStatus.SC_NO_CONTENT).thenReturn(HttpStatus.SC_OK);
8282
final var responseString = "{\"test\":\"test\"}";
83-
when(getResource.getRequestBodyAsString()).thenReturn(responseString);
83+
when(getResource.getResponseBodyAsString()).thenReturn(responseString);
8484

8585
final var query = Query.builder().get("").build();
8686
// First request will respond with NOT_FOUND
@@ -103,7 +103,7 @@ public void createNewTest() throws MapRouletteException
103103
final var postResource = factory.resource(HttpPost.METHOD_NAME);
104104
when(postResource.getStatusCode()).thenReturn(HttpStatus.SC_CREATED)
105105
.thenReturn(HttpStatus.SC_OK).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
106-
when(postResource.getRequestBodyAsString()).thenReturn("{\"id\":1234}")
106+
when(postResource.getResponseBodyAsString()).thenReturn("{\"id\":1234}")
107107
.thenReturn("{\"id\":6543}");
108108
final var query = Query.builder().post("").build();
109109
Assertions.assertEquals(Optional.of("{\"id\":1234}"), connection.execute(query));

0 commit comments

Comments
 (0)