32
32
import com .google .firebase .firestore .FirebaseFirestoreException ;
33
33
import com .google .firebase .firestore .FirebaseFirestoreSettings ;
34
34
import com .google .firebase .firestore .Query ;
35
- import com .google .firebase .firestore .QueryListenOptions ;
36
35
37
36
import org .junit .After ;
38
37
import org .junit .Before ;
@@ -123,16 +122,15 @@ public void setUp() throws Exception {
123
122
124
123
// Query is the whole collection ordered by field
125
124
mQuery = mCollectionRef .orderBy ("field" , Query .Direction .ASCENDING );
126
- mArray = new FirestoreArray <>(mQuery , new QueryListenOptions (),
127
- new ClassSnapshotParser <>(IntegerDocument .class ));
125
+ mArray = new FirestoreArray <>(mQuery , new ClassSnapshotParser <>(IntegerDocument .class ));
128
126
129
127
// Add a listener to the array so that it's active
130
128
mListener = mArray .addChangeEventListener (new LoggingListener ());
131
129
132
130
// Add some initial data
133
131
runAndVerify (new Callable <Task <?>>() {
134
132
@ Override
135
- public Task <?> call () throws Exception {
133
+ public Task <?> call () {
136
134
List <Task > tasks = new ArrayList <>();
137
135
for (int i = 0 ; i < INITIAL_SIZE ; i ++) {
138
136
tasks .add (mCollectionRef .document ().set (new IntegerDocument (i )));
@@ -142,14 +140,14 @@ public Task<?> call() throws Exception {
142
140
}
143
141
}, new Callable <Boolean >() {
144
142
@ Override
145
- public Boolean call () throws Exception {
143
+ public Boolean call () {
146
144
return mArray .size () == INITIAL_SIZE ;
147
145
}
148
146
});
149
147
}
150
148
151
149
@ After
152
- public void tearDown () throws Exception {
150
+ public void tearDown () {
153
151
if (mArray != null && mListener != null ) {
154
152
mArray .removeChangeEventListener (mListener );
155
153
} else {
@@ -164,12 +162,12 @@ public void tearDown() throws Exception {
164
162
public void testPushIncreasesSize () throws Exception {
165
163
runAndVerify (new Callable <Task <?>>() {
166
164
@ Override
167
- public Task <?> call () throws Exception {
165
+ public Task <?> call () {
168
166
return mCollectionRef .document ().set (new IntegerDocument (4 ));
169
167
}
170
168
}, new Callable <Boolean >() {
171
169
@ Override
172
- public Boolean call () throws Exception {
170
+ public Boolean call () {
173
171
return mArray .size () == (INITIAL_SIZE + 1 );
174
172
}
175
173
});
@@ -185,12 +183,12 @@ public void testAddToEnd() throws Exception {
185
183
186
184
runAndVerify (new Callable <Task <?>>() {
187
185
@ Override
188
- public Task <?> call () throws Exception {
186
+ public Task <?> call () {
189
187
return mCollectionRef .document ().set (new IntegerDocument (value ));
190
188
}
191
189
}, new Callable <Boolean >() {
192
190
@ Override
193
- public Boolean call () throws Exception {
191
+ public Boolean call () {
194
192
if (mArray .size () == (INITIAL_SIZE + 1 )) {
195
193
if (mArray .getObject (mArray .size () - 1 ).field == value ) {
196
194
return true ;
@@ -212,12 +210,12 @@ public void testAddToBeginning() throws Exception {
212
210
213
211
runAndVerify (new Callable <Task <?>>() {
214
212
@ Override
215
- public Task <?> call () throws Exception {
213
+ public Task <?> call () {
216
214
return mCollectionRef .document ().set (new IntegerDocument (value ));
217
215
}
218
216
}, new Callable <Boolean >() {
219
217
@ Override
220
- public Boolean call () throws Exception {
218
+ public Boolean call () {
221
219
if (mArray .size () == (INITIAL_SIZE + 1 )) {
222
220
if (mArray .getObject (0 ).field == value ) {
223
221
return true ;
0 commit comments