1
1
package com .google .firebase .cloud ;
2
2
3
+ import static org .junit .Assert .assertEquals ;
4
+ import static org .junit .Assert .assertNotNull ;
5
+ import static org .junit .Assert .assertNotSame ;
6
+ import static org .junit .Assert .assertSame ;
7
+ import static org .junit .Assert .assertThrows ;
8
+
3
9
import com .google .auth .oauth2 .GoogleCredentials ;
4
10
import com .google .cloud .firestore .DocumentReference ;
5
11
import com .google .cloud .firestore .Firestore ;
14
20
import org .junit .After ;
15
21
import org .junit .Test ;
16
22
17
- import static org .junit .Assert .*;
18
-
19
23
public class FirestoreClientTest {
20
24
21
25
private static final FirestoreOptions FIRESTORE_OPTIONS = FirestoreOptions .newBuilder ()
@@ -32,7 +36,7 @@ public void tearDown() {
32
36
33
37
@ Test
34
38
public void testExplicitProjectId () throws IOException {
35
- String databaseId = "databaseIdInTestExplicitProjectId" ;
39
+ final String databaseId = "databaseIdInTestExplicitProjectId" ;
36
40
FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
37
41
.setCredentials (GoogleCredentials .fromStream (ServiceAccount .EDITOR .asStream ()))
38
42
.setProjectId ("explicit-project-id" )
@@ -55,7 +59,7 @@ public void testExplicitProjectId() throws IOException {
55
59
56
60
@ Test
57
61
public void testServiceAccountProjectId () throws IOException {
58
- String databaseId = "databaseIdInTestServiceAccountProjectId" ;
62
+ final String databaseId = "databaseIdInTestServiceAccountProjectId" ;
59
63
FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
60
64
.setCredentials (GoogleCredentials .fromStream (ServiceAccount .EDITOR .asStream ()))
61
65
.setFirestoreOptions (FIRESTORE_OPTIONS )
@@ -77,7 +81,7 @@ public void testServiceAccountProjectId() throws IOException {
77
81
78
82
@ Test
79
83
public void testFirestoreOptions () throws IOException {
80
- String databaseId = "databaseIdInTestFirestoreOptions" ;
84
+ final String databaseId = "databaseIdInTestFirestoreOptions" ;
81
85
FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
82
86
.setCredentials (GoogleCredentials .fromStream (ServiceAccount .EDITOR .asStream ()))
83
87
.setProjectId ("explicit-project-id" )
@@ -100,7 +104,7 @@ public void testFirestoreOptions() throws IOException {
100
104
101
105
@ Test
102
106
public void testFirestoreOptionsOverride () throws IOException {
103
- String databaseId = "databaseIdInTestFirestoreOptions" ;
107
+ final String databaseId = "databaseIdInTestFirestoreOptions" ;
104
108
FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
105
109
.setCredentials (GoogleCredentials .fromStream (ServiceAccount .EDITOR .asStream ()))
106
110
.setProjectId ("explicit-project-id" )
@@ -120,7 +124,7 @@ public void testFirestoreOptionsOverride() throws IOException {
120
124
Firestore firestore2 = FirestoreClient .getFirestore (app , databaseId );
121
125
assertEquals ("explicit-project-id" , firestore2 .getOptions ().getProjectId ());
122
126
assertSame (ImplFirebaseTrampolines .getCredentials (app ),
123
- firestore2 .getOptions ().getCredentialsProvider ().getCredentials ());
127
+ firestore2 .getOptions ().getCredentialsProvider ().getCredentials ());
124
128
assertEquals (databaseId , firestore2 .getOptions ().getDatabaseId ());
125
129
126
130
assertSame (firestore2 , FirestoreClient .getFirestore (databaseId ));
@@ -130,7 +134,7 @@ public void testFirestoreOptionsOverride() throws IOException {
130
134
131
135
@ Test
132
136
public void testAppDelete () throws IOException {
133
- String databaseId = "databaseIdInTestAppDelete" ;
137
+ final String databaseId = "databaseIdInTestAppDelete" ;
134
138
FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
135
139
.setCredentials (GoogleCredentials .fromStream (ServiceAccount .EDITOR .asStream ()))
136
140
.setProjectId ("mock-project-id" )
0 commit comments