Search in sources :

Example 1 with FirebaseApp

use of com.google.firebase.FirebaseApp in project FirebaseUI-Android by firebase.

the class FirebaseArrayOfObjectsTest method setUp.

@Before
public void setUp() throws Exception {
    FirebaseApp app = getAppInstance(InstrumentationRegistry.getContext());
    mRef = FirebaseDatabase.getInstance(app).getReference().child("firebasearray").child("objects");
    mArray = new FirebaseArray(mRef);
    mRef.removeValue();
    runAndWaitUntil(mArray, new Runnable() {

        @Override
        public void run() {
            for (int i = 1; i <= INITIAL_SIZE; i++) {
                mRef.push().setValue(new Bean(i, "Text " + i, i % 2 == 0), i);
            }
        }
    }, new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return mArray.getCount() == INITIAL_SIZE;
        }
    });
}
Also used : FirebaseApp(com.google.firebase.FirebaseApp) TestUtils.getBean(com.firebase.ui.database.TestUtils.getBean) Before(org.junit.Before)

Example 2 with FirebaseApp

use of com.google.firebase.FirebaseApp in project FirebaseUI-Android by firebase.

the class FirebaseArrayTest method setUp.

@Before
public void setUp() throws Exception {
    FirebaseApp app = getAppInstance(InstrumentationRegistry.getContext());
    mRef = FirebaseDatabase.getInstance(app).getReference().child("firebasearray");
    mArray = new FirebaseArray(mRef);
    mRef.removeValue();
    runAndWaitUntil(mArray, new Runnable() {

        @Override
        public void run() {
            for (int i = 1; i <= INITIAL_SIZE; i++) {
                mRef.push().setValue(i, i);
            }
        }
    }, new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return mArray.getCount() == INITIAL_SIZE;
        }
    });
}
Also used : FirebaseApp(com.google.firebase.FirebaseApp) Before(org.junit.Before)

Aggregations

FirebaseApp (com.google.firebase.FirebaseApp)2 Before (org.junit.Before)2 TestUtils.getBean (com.firebase.ui.database.TestUtils.getBean)1