Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abubkr-hago committed Aug 16, 2024
1 parent a6270d7 commit 4650289
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
5 changes: 4 additions & 1 deletion parse/src/main/java/com/parse/ParseException.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ public class ParseException extends Exception {
public static final int FILE_DELETE_ERROR = 153;
/** Error code indicating that the application has exceeded its request limit. */
public static final int REQUEST_LIMIT_EXCEEDED = 155;
/** Error code indicating that the request was a duplicate and has been discarded due to idempotency rules. */
/**
* Error code indicating that the request was a duplicate and has been discarded due to
* idempotency rules.
*/
public static final int DUPLICATE_REQUEST = 159;
/** Error code indicating that the provided event name is invalid. */
public static final int INVALID_EVENT_NAME = 160;
Expand Down
30 changes: 15 additions & 15 deletions parse/src/test/java/com/parse/ParseRESTCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,27 +562,27 @@ public void testIdempotencyLogic() throws Exception {
ParseHttpClient mockHttpClient = mock(ParseHttpClient.class);
AtomicReference<String> requestIdAtomicReference = new AtomicReference<>();
when(mockHttpClient.execute(
argThat(
argument -> {
assertNotNull(
argument.getHeader(ParseRESTCommand.HEADER_REQUEST_ID));
if (requestIdAtomicReference.get() == null)
requestIdAtomicReference.set(
argument.getHeader(
ParseRESTCommand.HEADER_REQUEST_ID));
assertEquals(
argument.getHeader(ParseRESTCommand.HEADER_REQUEST_ID),
requestIdAtomicReference.get());
return true;
})))
.thenThrow(new IOException());
argThat(
argument -> {
assertNotNull(
argument.getHeader(ParseRESTCommand.HEADER_REQUEST_ID));
if (requestIdAtomicReference.get() == null)
requestIdAtomicReference.set(
argument.getHeader(
ParseRESTCommand.HEADER_REQUEST_ID));
assertEquals(
argument.getHeader(ParseRESTCommand.HEADER_REQUEST_ID),
requestIdAtomicReference.get());
return true;
})))
.thenThrow(new IOException());

ParseRESTCommand.server = new URL("http://parse.com");
ParseRESTCommand command = new ParseRESTCommand.Builder().build();
Task<Void> task = command.executeAsync(mockHttpClient).makeVoid();
task.waitForCompletion();

verify(mockHttpClient, times(ParseRequest.DEFAULT_MAX_RETRIES + 1))
.execute(any(ParseHttpRequest.class));
.execute(any(ParseHttpRequest.class));
}
}

0 comments on commit 4650289

Please sign in to comment.