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);
}
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);
}
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());
}
Aggregations