Search in sources :

Example 1 with SyncStats

use of android.content.SyncStats 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 2 with SyncStats

use of android.content.SyncStats 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)

Aggregations

SyncResult (android.content.SyncResult)2 SyncStats (android.content.SyncStats)2 Field (java.lang.reflect.Field)2 Test (org.junit.Test)2