Skip to content

Commit

Permalink
chore: remove unused throws from test methods (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-qlogic committed May 13, 2020
1 parent 2a4a7b5 commit 81c20c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
Expand Up @@ -165,7 +165,7 @@ public void limitToLastRequiresAtLeastOneOrderingConstraint() throws Exception {
}

@Test
public void limitToLastRejectsStream() throws Exception {
public void limitToLastRejectsStream() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand Down Expand Up @@ -304,7 +304,7 @@ public void inQueriesWithReferenceArray() throws Exception {
}

@Test
public void validatesInQueries() throws Exception {
public void validatesInQueries() {
try {
query.whereIn(FieldPath.documentId(), Arrays.<Object>asList("foo", 42)).get();
fail();
Expand All @@ -325,7 +325,7 @@ public void validatesInQueries() throws Exception {
}

@Test
public void validatesQueryOperatorForFieldPathDocumentId() throws Exception {
public void validatesQueryOperatorForFieldPathDocumentId() {
try {
query.whereArrayContains(FieldPath.documentId(), "bar");
fail();
Expand Down Expand Up @@ -447,7 +447,7 @@ public void withFieldPathSelect() throws Exception {
}

@Test
public void withDocumentSnapshotCursor() throws Exception {
public void withDocumentSnapshotCursor() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand All @@ -468,7 +468,7 @@ public void withDocumentSnapshotCursor() throws Exception {
}

@Test
public void withDocumentIdAndDocumentSnapshotCursor() throws Exception {
public void withDocumentIdAndDocumentSnapshotCursor() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand All @@ -489,7 +489,7 @@ public void withDocumentIdAndDocumentSnapshotCursor() throws Exception {
}

@Test
public void withExtractedDirectionForDocumentSnapshotCursor() throws Exception {
public void withExtractedDirectionForDocumentSnapshotCursor() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand All @@ -512,7 +512,7 @@ public void withExtractedDirectionForDocumentSnapshotCursor() throws Exception {
}

@Test
public void withInequalityFilterForDocumentSnapshotCursor() throws Exception {
public void withInequalityFilterForDocumentSnapshotCursor() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand Down Expand Up @@ -543,7 +543,7 @@ public void withInequalityFilterForDocumentSnapshotCursor() throws Exception {
}

@Test
public void withEqualityFilterForDocumentSnapshotCursor() throws Exception {
public void withEqualityFilterForDocumentSnapshotCursor() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand Down Expand Up @@ -588,7 +588,7 @@ public void withStartAt() throws Exception {
}

@Test
public void withInvalidStartAt() throws Exception {
public void withInvalidStartAt() {
try {
query.orderBy(FieldPath.documentId()).startAt(42).get();
fail();
Expand Down Expand Up @@ -670,7 +670,7 @@ public void withEndAt() throws Exception {
}

@Test
public void withCollectionGroup() throws Exception {
public void withCollectionGroup() {
doAnswer(queryResponse())
.when(firestoreMock)
.streamRequest(
Expand Down Expand Up @@ -707,12 +707,12 @@ public void collectionGroupCannotContainSlashes() {
}

@Test(expected = IllegalStateException.class)
public void overspecifiedCursor() throws Exception {
public void overspecifiedCursor() {
query.orderBy("foo").startAt("foo", "bar", "bar", "foo");
}

@Test(expected = IllegalStateException.class)
public void orderByWithCursor() throws Exception {
public void orderByWithCursor() {
query.startAt("foo").orderBy("foo");
}

Expand Down Expand Up @@ -798,7 +798,7 @@ public void onCompleted() {
}

@Test
public void equalsTest() throws Exception {
public void equalsTest() {
assertEquals(query.limit(42).offset(1337), query.offset(1337).limit(42));
assertEquals(query.limit(42).offset(1337).hashCode(), query.offset(1337).limit(42).hashCode());
}
Expand Down
Expand Up @@ -219,7 +219,7 @@ public ApiFuture<String> updateCallback(Transaction transaction) {
}

@Test
public void rollbackOnCallbackError() throws Exception {
public void rollbackOnCallbackError() {
doReturn(beginResponse())
.doReturn(rollbackResponse())
.when(firestoreMock)
Expand Down Expand Up @@ -250,7 +250,7 @@ public String updateCallback(Transaction transaction) throws Exception {
}

@Test
public void rollbackOnCallbackErrorAsync() throws Exception {
public void rollbackOnCallbackErrorAsync() {
doReturn(beginResponse())
.doReturn(rollbackResponse())
.when(firestoreMock)
Expand Down Expand Up @@ -281,7 +281,7 @@ public ApiFuture<String> updateCallback(Transaction transaction) {
}

@Test
public void noRollbackOnBeginFailure() throws Exception {
public void noRollbackOnBeginFailure() {
doReturn(ApiFutures.immediateFailedFuture(new Exception("Expected exception")))
.when(firestoreMock)
.sendRequest(requestCapture.capture(), Matchers.<UnaryCallable<Message, Message>>any());
Expand Down Expand Up @@ -309,7 +309,7 @@ public String updateCallback(Transaction transaction) {
}

@Test
public void noRollbackOnBeginFailureAsync() throws Exception {
public void noRollbackOnBeginFailureAsync() {
doReturn(ApiFutures.immediateFailedFuture(new Exception("Expected exception")))
.when(firestoreMock)
.sendRequest(requestCapture.capture(), Matchers.<UnaryCallable<Message, Message>>any());
Expand Down Expand Up @@ -337,7 +337,7 @@ public ApiFuture<String> updateCallback(Transaction transaction) {
}

@Test
public void limitsRetriesWithFailure() throws Exception {
public void limitsRetriesWithFailure() {
RequestResponseMap requestResponseMap =
new RequestResponseMap() {
{
Expand Down
Expand Up @@ -990,23 +990,23 @@ private ListenResponse docRemove(String docPath) {
return response.build();
}

private void send(ListenResponse response) throws InterruptedException {
private void send(ListenResponse response) {
streamObserverCapture.getValue().onNext(response);
}

private void destroy(Code code) throws InterruptedException {
private void destroy(Code code) {
streamObserverCapture.getValue().onError(new StatusException(io.grpc.Status.fromCode(code)));
}

private void close() throws InterruptedException {
private void close() {
streamObserverCapture.getValue().onCompleted();
}

/** Returns a new request observer that persists its input. */
private Answer newRequestObserver() {
return new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
public Object answer(InvocationOnMock invocationOnMock) {
return new ApiStreamObserver<ListenRequest>() {
@Override
public void onNext(ListenRequest listenRequest) {
Expand Down

0 comments on commit 81c20c5

Please sign in to comment.