Skip to content

Commit

Permalink
fix: catch null Firestore in system tests (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Chen committed May 13, 2020
1 parent b376003 commit 2a4a7b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -39,6 +39,7 @@
import com.google.common.base.Joiner;
import com.google.common.base.Joiner.MapJoiner;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Range;
Expand Down Expand Up @@ -83,6 +84,9 @@ public void before() {

@AfterClass
public static void afterClass() throws Exception {
Preconditions.checkNotNull(
firestore,
"Error instantiating Firestore. Check that the service account credentials were properly set.");
firestore.close();
}

Expand Down
Expand Up @@ -55,6 +55,7 @@
import com.google.cloud.firestore.Transaction.Function;
import com.google.cloud.firestore.WriteBatch;
import com.google.cloud.firestore.WriteResult;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
Expand Down Expand Up @@ -104,6 +105,9 @@ public void before() {

@After
public void after() throws Exception {
Preconditions.checkNotNull(
firestore,
"Error instantiating Firestore. Check that the service account credentials were properly set.");
firestore.close();
}

Expand Down

0 comments on commit 2a4a7b5

Please sign in to comment.