Search in sources :

Example 1 with SyncStatusAppState

use of org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState in project collect by opendatakit.

the class SyncStatusAppStateTest method isSyncing_isDifferentForDifferentProjects.

@Test
public void isSyncing_isDifferentForDifferentProjects() {
    SyncStatusAppState syncStatusAppState = new SyncStatusAppState(context);
    syncStatusAppState.startSync("projectId");
    assertThat(syncStatusAppState.isSyncing("projectId").getValue(), is(true));
    assertThat(syncStatusAppState.isSyncing("otherProjectId").getValue(), is(false));
}
Also used : SyncStatusAppState(org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState) Test(org.junit.Test)

Example 2 with SyncStatusAppState

use of org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState in project collect by opendatakit.

the class SyncStatusAppStateTest method getSyncError_whenFinishSyncWithException_isException.

@Test
public void getSyncError_whenFinishSyncWithException_isException() {
    SyncStatusAppState syncStatusAppState = new SyncStatusAppState(context);
    syncStatusAppState.startSync("projectId");
    FormSourceException exception = new FormSourceException.FetchError();
    syncStatusAppState.finishSync("projectId", exception);
    assertThat(syncStatusAppState.getSyncError("projectId").getValue(), is(exception));
}
Also used : FormSourceException(org.odk.collect.forms.FormSourceException) SyncStatusAppState(org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState) Test(org.junit.Test)

Example 3 with SyncStatusAppState

use of org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState in project collect by opendatakit.

the class SyncStatusAppStateTest method getSyncError_whenFinishSyncWithNull_isNull.

@Test
public void getSyncError_whenFinishSyncWithNull_isNull() {
    SyncStatusAppState syncStatusAppState = new SyncStatusAppState(context);
    syncStatusAppState.startSync("projectId");
    syncStatusAppState.finishSync("projectId", null);
    assertThat(syncStatusAppState.getSyncError("projectId").getValue(), is(nullValue()));
}
Also used : SyncStatusAppState(org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState) Test(org.junit.Test)

Example 4 with SyncStatusAppState

use of org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState in project collect by opendatakit.

the class SyncStatusAppStateTest method getSyncError_isNullAtFirst.

@Test
public void getSyncError_isNullAtFirst() {
    SyncStatusAppState syncStatusAppState = new SyncStatusAppState(context);
    assertThat(syncStatusAppState.getSyncError("projectId").getValue(), is(nullValue()));
}
Also used : SyncStatusAppState(org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState) Test(org.junit.Test)

Example 5 with SyncStatusAppState

use of org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState in project collect by opendatakit.

the class SyncStatusAppStateTest method getSyncError_isDifferentForDifferentProjects.

@Test
public void getSyncError_isDifferentForDifferentProjects() {
    SyncStatusAppState syncStatusAppState = new SyncStatusAppState(context);
    syncStatusAppState.startSync("projectId");
    syncStatusAppState.finishSync("projectId", new FormSourceException.FetchError());
    assertThat(syncStatusAppState.getSyncError("projectId").getValue(), is(notNullValue()));
    assertThat(syncStatusAppState.getSyncError("otherProjectId").getValue(), is(nullValue()));
}
Also used : FormSourceException(org.odk.collect.forms.FormSourceException) SyncStatusAppState(org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 SyncStatusAppState (org.odk.collect.android.formmanagement.matchexactly.SyncStatusAppState)6 FormSourceException (org.odk.collect.forms.FormSourceException)2