19
19
import java .io .IOException ;
20
20
import org .junit .After ;
21
21
import org .junit .Test ;
22
- import org .junit .function .ThrowingRunnable ;
23
22
24
23
public class FirestoreClientTest {
25
24
@@ -136,7 +135,7 @@ public void testFirestoreOptionsOverride() throws IOException {
136
135
@ Test
137
136
public void testAppDelete () throws IOException {
138
137
final String databaseId = "databaseIdInTestAppDelete" ;
139
- final FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
138
+ FirebaseApp app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
140
139
.setCredentials (GoogleCredentials .fromStream (ServiceAccount .EDITOR .asStream ()))
141
140
.setProjectId ("mock-project-id" )
142
141
.setFirestoreOptions (FIRESTORE_OPTIONS )
@@ -152,33 +151,13 @@ public void testAppDelete() throws IOException {
152
151
153
152
assertNotSame (firestore1 , firestore2 );
154
153
155
- final DocumentReference document = firestore1 .collection ("collection" ).document ("doc" );
154
+ DocumentReference document = firestore1 .collection ("collection" ).document ("doc" );
156
155
app .delete ();
157
156
158
- assertThrows (IllegalStateException .class , new ThrowingRunnable () {
159
- public void run () {
160
- FirestoreClient .getFirestore (app );
161
- }
162
- });
163
- assertThrows (IllegalStateException .class , new ThrowingRunnable () {
164
- public void run () throws Throwable {
165
- document .get ();
166
- }
167
- });
168
- assertThrows (IllegalStateException .class , new ThrowingRunnable () {
169
- public void run () throws Throwable {
170
- FirestoreClient .getFirestore ();
171
- }
172
- });
173
- assertThrows (IllegalStateException .class , new ThrowingRunnable () {
174
- public void run () throws Throwable {
175
- FirestoreClient .getFirestore (app , databaseId );
176
- }
177
- });
178
- assertThrows (IllegalStateException .class , new ThrowingRunnable () {
179
- public void run () throws Throwable {
180
- FirestoreClient .getFirestore (databaseId );
181
- }
182
- });
157
+ assertThrows (IllegalStateException .class , () -> FirestoreClient .getFirestore (app ));
158
+ assertThrows (IllegalStateException .class , () -> document .get ());
159
+ assertThrows (IllegalStateException .class , () -> FirestoreClient .getFirestore ());
160
+ assertThrows (IllegalStateException .class , () -> FirestoreClient .getFirestore (app , databaseId ));
161
+ assertThrows (IllegalStateException .class , () -> FirestoreClient .getFirestore (databaseId ));
183
162
}
184
163
}
0 commit comments