19
19
import static com .google .firebase .firestore .testutil .TestUtil .key ;
20
20
import static org .mockito .Mockito .mock ;
21
21
22
- import com .google .android .gms .tasks .Task ;
23
22
import com .google .firebase .database .collection .ImmutableSortedSet ;
24
23
import com .google .firebase .firestore .core .DocumentViewChange ;
25
24
import com .google .firebase .firestore .core .DocumentViewChange .Type ;
26
25
import com .google .firebase .firestore .core .ViewSnapshot ;
27
26
import com .google .firebase .firestore .model .Document ;
28
27
import com .google .firebase .firestore .model .DocumentKey ;
29
28
import com .google .firebase .firestore .model .DocumentSet ;
30
- import com .google .firebase .firestore .model .ResourcePath ;
31
29
import com .google .firebase .firestore .model .value .ObjectValue ;
32
30
import java .util .ArrayList ;
33
31
import java .util .List ;
34
32
import java .util .Map ;
35
- import org .junit .Assert ;
36
- import org .robolectric .Robolectric ;
37
33
38
34
public class TestUtil {
39
35
@@ -43,14 +39,6 @@ public static FirebaseFirestore firestore() {
43
39
return FIRESTORE ;
44
40
}
45
41
46
- public static CollectionReference collectionReference (String path ) {
47
- return new CollectionReference (ResourcePath .fromString (path ), FIRESTORE );
48
- }
49
-
50
- public static DocumentReference documentReference (String path ) {
51
- return new DocumentReference (key (path ), FIRESTORE );
52
- }
53
-
54
42
public static DocumentSnapshot documentSnapshot (
55
43
String path , Map <String , Object > data , boolean isFromCache ) {
56
44
if (data == null ) {
@@ -133,13 +121,4 @@ public static QuerySnapshot querySnapshot(
133
121
/* excludesMetadataChanges= */ false );
134
122
return new QuerySnapshot (query (path ), viewSnapshot , FIRESTORE );
135
123
}
136
-
137
- public static <T > T waitFor (Task <T > task ) {
138
- if (!task .isComplete ()) {
139
- Robolectric .flushBackgroundThreadScheduler ();
140
- }
141
- Assert .assertTrue (
142
- "Expected task to be completed after background thread flush" , task .isComplete ());
143
- return task .getResult ();
144
- }
145
124
}
0 commit comments