Search in sources :

Example 6 with SyncResult

use of android.content.SyncResult in project android by JetBrains.

the class UnitTest method instanceFields.

@Test
public void instanceFields() throws Exception {
    SyncResult result = mock(SyncResult.class);
    Field statsField = result.getClass().getField("stats");
    SyncStats syncStats = mock(SyncStats.class);
    statsField.set(result, syncStats);
    syncStats.numDeletes = 42;
    assertEquals(42, result.stats.numDeletes);
}
Also used : Field(java.lang.reflect.Field) SyncStats(android.content.SyncStats) SyncResult(android.content.SyncResult) Test(org.junit.Test)

Example 7 with SyncResult

use of android.content.SyncResult in project android by JetBrains.

the class LibUnitTest method instanceFields.

@Test
public void instanceFields() throws Exception {
    SyncResult result = mock(SyncResult.class);
    Field statsField = result.getClass().getField("stats");
    SyncStats syncStats = mock(SyncStats.class);
    statsField.set(result, syncStats);
    syncStats.numDeletes = 42;
    assertEquals(42, result.stats.numDeletes);
}
Also used : Field(java.lang.reflect.Field) SyncStats(android.content.SyncStats) SyncResult(android.content.SyncResult) Test(org.junit.Test)

Example 8 with SyncResult

use of android.content.SyncResult in project robolectric by robolectric.

the class ShadowSyncResultTest method hasHardError.

@Test
public void hasHardError() throws Exception {
    SyncResult result = new SyncResult();
    assertFalse(result.hasHardError());
    result.stats.numAuthExceptions++;
    assertTrue(result.hasHardError());
    assertTrue(result.hasError());
}
Also used : SyncResult(android.content.SyncResult) Test(org.junit.Test)

Aggregations

SyncResult (android.content.SyncResult)8 Test (org.junit.Test)7 SyncStats (android.content.SyncStats)2 Field (java.lang.reflect.Field)2 Account (android.accounts.Account)1 Context (android.content.Context)1 Bundle (android.os.Bundle)1 SyncHelper (com.google.samples.apps.iosched.sync.SyncHelper)1