|
38 | 38 |
|
39 | 39 | public class FirebaseDatabaseTest {
|
40 | 40 |
|
41 |
| - private static FirebaseOptions firebaseOptions = |
| 41 | + private static final FirebaseOptions firebaseOptions = |
42 | 42 | new FirebaseOptions.Builder()
|
43 | 43 | .setCredentials(TestUtils.getCertCredential(ServiceAccount.EDITOR.asStream()))
|
44 | 44 | .setDatabaseUrl("https://firebase-db-test.firebaseio.com")
|
45 | 45 | .build();
|
| 46 | + private static final FirebaseOptions firebaseOptionsWithoutDatabaseUrl = |
| 47 | + new FirebaseOptions.Builder() |
| 48 | + .setCredentials(TestUtils.getCertCredential(ServiceAccount.EDITOR.asStream())) |
| 49 | + .build(); |
46 | 50 |
|
47 | 51 | @Test
|
48 | 52 | public void testGetInstance() {
|
@@ -210,9 +214,10 @@ public void testDbUrlIsEmulatorUrlWhenSettingOptionsManually() {
|
210 | 214 | new CustomTestCase("https://test.firebaseio.com?ns=valid-namespace", "localhost:90",
|
211 | 215 | "http://localhost:90", "valid-namespace")
|
212 | 216 | );
|
| 217 | + |
213 | 218 | for (CustomTestCase tc : testCases) {
|
214 | 219 | try {
|
215 |
| - FirebaseApp app = FirebaseApp.initializeApp(); |
| 220 | + FirebaseApp app = FirebaseApp.initializeApp(firebaseOptionsWithoutDatabaseUrl); |
216 | 221 | TestUtils.setEnvironmentVariables(
|
217 | 222 | ImmutableMap.of(EmulatorHelper.FIREBASE_RTDB_EMULATOR_HOST_ENV_VAR,
|
218 | 223 | Strings.nullToEmpty(tc.envVariableUrl)));
|
@@ -249,7 +254,7 @@ public void testDbUrlIsEmulatorUrlForDbRefWithPath() {
|
249 | 254 |
|
250 | 255 | for (CustomTestCase tc : testCases) {
|
251 | 256 | try {
|
252 |
| - FirebaseApp app = FirebaseApp.initializeApp(); |
| 257 | + FirebaseApp app = FirebaseApp.initializeApp(firebaseOptionsWithoutDatabaseUrl); |
253 | 258 | TestUtils.setEnvironmentVariables(
|
254 | 259 | ImmutableMap.of(EmulatorHelper.FIREBASE_RTDB_EMULATOR_HOST_ENV_VAR,
|
255 | 260 | Strings.nullToEmpty(tc.envVariableUrl)));
|
|
0 commit comments