Skip to content

Commit

Permalink
Fix requests to send (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
e7mac authored Oct 2, 2018
1 parent d644c98 commit 939bc66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ private RequestsWithEncoding getRequestsWithEncodedStringForErrors() {
unsentRequests.add(error);
}
requestsToSend = unsentRequests;
jsonEncodedRequestsToSend = jsonEncodeUnsentRequests(unsentRequests);
jsonEncodedRequestsToSend = jsonEncodeRequests(unsentRequests);

RequestsWithEncoding requestsWithEncoding = new RequestsWithEncoding();
// for errors, we send all unsent requests so they are identical
Expand All @@ -556,7 +556,7 @@ protected RequestsWithEncoding getRequestsWithEncodedStringStoredRequests(double
requestsToSend = removeIrrelevantBackgroundStartRequests(unsentRequests);
}

jsonEncodedRequestsToSend = jsonEncodeUnsentRequests(unsentRequests);
jsonEncodedRequestsToSend = jsonEncodeRequests(requestsToSend);
requestsWithEncoding.unsentRequests = unsentRequests;
requestsWithEncoding.requestsToSend = requestsToSend;
requestsWithEncoding.jsonEncodedString = jsonEncodedRequestsToSend;
Expand Down Expand Up @@ -750,7 +750,7 @@ private static List<Map<String, Object>> removeIrrelevantBackgroundStartRequests
return relevantRequests;
}

protected static String jsonEncodeUnsentRequests(List<Map<String, Object>> requestData) {
protected static String jsonEncodeRequests(List<Map<String, Object>> requestData) {
Map<String, Object> data = new HashMap<>();
data.put(Constants.Params.DATA, requestData);
return JsonConverter.toJson(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public void testJsonEncodeUnsentRequests() {
@Test
public void testGetRequestsWithEncodedStringStoredRequests() {
List<Map<String, Object>> requests = mockRequests(4);
String json = Request.jsonEncodeUnsentRequests(requests);
String json = Request.jsonEncodeRequests(requests);

final String expectedJson = "{\"data\":[{\"0\":\"testData\"},{\"1\":\"testData\"},{\"2\":\"testData\"},{\"3\":\"testData\"}]}";
assertEquals(json, expectedJson);
Expand Down

0 comments on commit 939bc66

Please sign in to comment.