Skip to content

Commit 81c20c5

Browse files
authored
chore: remove unused throws from test methods (#214)
1 parent 2a4a7b5 commit 81c20c5

3 files changed

Lines changed: 22 additions & 22 deletions

File tree

google-cloud-firestore/src/test/java/com/google/cloud/firestore/QueryTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void limitToLastRequiresAtLeastOneOrderingConstraint() throws Exception {
165165
}
166166

167167
@Test
168-
public void limitToLastRejectsStream() throws Exception {
168+
public void limitToLastRejectsStream() {
169169
doAnswer(queryResponse())
170170
.when(firestoreMock)
171171
.streamRequest(
@@ -304,7 +304,7 @@ public void inQueriesWithReferenceArray() throws Exception {
304304
}
305305

306306
@Test
307-
public void validatesInQueries() throws Exception {
307+
public void validatesInQueries() {
308308
try {
309309
query.whereIn(FieldPath.documentId(), Arrays.<Object>asList("foo", 42)).get();
310310
fail();
@@ -325,7 +325,7 @@ public void validatesInQueries() throws Exception {
325325
}
326326

327327
@Test
328-
public void validatesQueryOperatorForFieldPathDocumentId() throws Exception {
328+
public void validatesQueryOperatorForFieldPathDocumentId() {
329329
try {
330330
query.whereArrayContains(FieldPath.documentId(), "bar");
331331
fail();
@@ -447,7 +447,7 @@ public void withFieldPathSelect() throws Exception {
447447
}
448448

449449
@Test
450-
public void withDocumentSnapshotCursor() throws Exception {
450+
public void withDocumentSnapshotCursor() {
451451
doAnswer(queryResponse())
452452
.when(firestoreMock)
453453
.streamRequest(
@@ -468,7 +468,7 @@ public void withDocumentSnapshotCursor() throws Exception {
468468
}
469469

470470
@Test
471-
public void withDocumentIdAndDocumentSnapshotCursor() throws Exception {
471+
public void withDocumentIdAndDocumentSnapshotCursor() {
472472
doAnswer(queryResponse())
473473
.when(firestoreMock)
474474
.streamRequest(
@@ -489,7 +489,7 @@ public void withDocumentIdAndDocumentSnapshotCursor() throws Exception {
489489
}
490490

491491
@Test
492-
public void withExtractedDirectionForDocumentSnapshotCursor() throws Exception {
492+
public void withExtractedDirectionForDocumentSnapshotCursor() {
493493
doAnswer(queryResponse())
494494
.when(firestoreMock)
495495
.streamRequest(
@@ -512,7 +512,7 @@ public void withExtractedDirectionForDocumentSnapshotCursor() throws Exception {
512512
}
513513

514514
@Test
515-
public void withInequalityFilterForDocumentSnapshotCursor() throws Exception {
515+
public void withInequalityFilterForDocumentSnapshotCursor() {
516516
doAnswer(queryResponse())
517517
.when(firestoreMock)
518518
.streamRequest(
@@ -543,7 +543,7 @@ public void withInequalityFilterForDocumentSnapshotCursor() throws Exception {
543543
}
544544

545545
@Test
546-
public void withEqualityFilterForDocumentSnapshotCursor() throws Exception {
546+
public void withEqualityFilterForDocumentSnapshotCursor() {
547547
doAnswer(queryResponse())
548548
.when(firestoreMock)
549549
.streamRequest(
@@ -588,7 +588,7 @@ public void withStartAt() throws Exception {
588588
}
589589

590590
@Test
591-
public void withInvalidStartAt() throws Exception {
591+
public void withInvalidStartAt() {
592592
try {
593593
query.orderBy(FieldPath.documentId()).startAt(42).get();
594594
fail();
@@ -670,7 +670,7 @@ public void withEndAt() throws Exception {
670670
}
671671

672672
@Test
673-
public void withCollectionGroup() throws Exception {
673+
public void withCollectionGroup() {
674674
doAnswer(queryResponse())
675675
.when(firestoreMock)
676676
.streamRequest(
@@ -707,12 +707,12 @@ public void collectionGroupCannotContainSlashes() {
707707
}
708708

709709
@Test(expected = IllegalStateException.class)
710-
public void overspecifiedCursor() throws Exception {
710+
public void overspecifiedCursor() {
711711
query.orderBy("foo").startAt("foo", "bar", "bar", "foo");
712712
}
713713

714714
@Test(expected = IllegalStateException.class)
715-
public void orderByWithCursor() throws Exception {
715+
public void orderByWithCursor() {
716716
query.startAt("foo").orderBy("foo");
717717
}
718718

@@ -798,7 +798,7 @@ public void onCompleted() {
798798
}
799799

800800
@Test
801-
public void equalsTest() throws Exception {
801+
public void equalsTest() {
802802
assertEquals(query.limit(42).offset(1337), query.offset(1337).limit(42));
803803
assertEquals(query.limit(42).offset(1337).hashCode(), query.offset(1337).limit(42).hashCode());
804804
}

google-cloud-firestore/src/test/java/com/google/cloud/firestore/TransactionTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public ApiFuture<String> updateCallback(Transaction transaction) {
219219
}
220220

221221
@Test
222-
public void rollbackOnCallbackError() throws Exception {
222+
public void rollbackOnCallbackError() {
223223
doReturn(beginResponse())
224224
.doReturn(rollbackResponse())
225225
.when(firestoreMock)
@@ -250,7 +250,7 @@ public String updateCallback(Transaction transaction) throws Exception {
250250
}
251251

252252
@Test
253-
public void rollbackOnCallbackErrorAsync() throws Exception {
253+
public void rollbackOnCallbackErrorAsync() {
254254
doReturn(beginResponse())
255255
.doReturn(rollbackResponse())
256256
.when(firestoreMock)
@@ -281,7 +281,7 @@ public ApiFuture<String> updateCallback(Transaction transaction) {
281281
}
282282

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

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

339339
@Test
340-
public void limitsRetriesWithFailure() throws Exception {
340+
public void limitsRetriesWithFailure() {
341341
RequestResponseMap requestResponseMap =
342342
new RequestResponseMap() {
343343
{

google-cloud-firestore/src/test/java/com/google/cloud/firestore/WatchTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,23 +990,23 @@ private ListenResponse docRemove(String docPath) {
990990
return response.build();
991991
}
992992

993-
private void send(ListenResponse response) throws InterruptedException {
993+
private void send(ListenResponse response) {
994994
streamObserverCapture.getValue().onNext(response);
995995
}
996996

997-
private void destroy(Code code) throws InterruptedException {
997+
private void destroy(Code code) {
998998
streamObserverCapture.getValue().onError(new StatusException(io.grpc.Status.fromCode(code)));
999999
}
10001000

1001-
private void close() throws InterruptedException {
1001+
private void close() {
10021002
streamObserverCapture.getValue().onCompleted();
10031003
}
10041004

10051005
/** Returns a new request observer that persists its input. */
10061006
private Answer newRequestObserver() {
10071007
return new Answer() {
10081008
@Override
1009-
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
1009+
public Object answer(InvocationOnMock invocationOnMock) {
10101010
return new ApiStreamObserver<ListenRequest>() {
10111011
@Override
10121012
public void onNext(ListenRequest listenRequest) {

0 commit comments

Comments
 (0)