Search in sources :

Example 1 with SQLiteMode

use of org.robolectric.annotation.SQLiteMode in project robolectric by robolectric.

the class SQLiteModeConfigurerClassTest method shouldUseRealisticShadows.

@Test
@SQLiteMode(Mode.NATIVE)
public void shouldUseRealisticShadows() {
    assertThat(ConfigurationRegistry.get(Mode.class)).isSameInstanceAs(Mode.NATIVE);
    try (CursorWindow cursorWindow = new CursorWindow("2")) {
        ShadowCursorWindow shadow = Shadow.extract(cursorWindow);
        assertThat(shadow).isInstanceOf(ShadowNativeCursorWindow.class);
    }
}
Also used : ShadowLegacyCursorWindow(org.robolectric.shadows.ShadowLegacyCursorWindow) ShadowCursorWindow(org.robolectric.shadows.ShadowCursorWindow) CursorWindow(android.database.CursorWindow) ShadowNativeCursorWindow(org.robolectric.shadows.ShadowNativeCursorWindow) ShadowCursorWindow(org.robolectric.shadows.ShadowCursorWindow) Test(org.junit.Test) SQLiteMode(org.robolectric.annotation.SQLiteMode)

Example 2 with SQLiteMode

use of org.robolectric.annotation.SQLiteMode in project robolectric by robolectric.

the class SQLiteModeConfigurerClassTest method shouldUseLegacyShadows.

@Test
@SQLiteMode(Mode.LEGACY)
public void shouldUseLegacyShadows() {
    assertThat(ConfigurationRegistry.get(Mode.class)).isSameInstanceAs(Mode.LEGACY);
    try (CursorWindow cursorWindow = new CursorWindow("1")) {
        ShadowCursorWindow shadow = Shadow.extract(cursorWindow);
        assertThat(shadow).isInstanceOf(ShadowLegacyCursorWindow.class);
    }
}
Also used : ShadowLegacyCursorWindow(org.robolectric.shadows.ShadowLegacyCursorWindow) ShadowCursorWindow(org.robolectric.shadows.ShadowCursorWindow) CursorWindow(android.database.CursorWindow) ShadowNativeCursorWindow(org.robolectric.shadows.ShadowNativeCursorWindow) ShadowCursorWindow(org.robolectric.shadows.ShadowCursorWindow) Test(org.junit.Test) SQLiteMode(org.robolectric.annotation.SQLiteMode)

Example 3 with SQLiteMode

use of org.robolectric.annotation.SQLiteMode in project robolectric by robolectric.

the class SQLiteModeConfigurerClassTest method shouldPreferCustomShadows.

@Test
@SQLiteMode(Mode.NATIVE)
@Config(shadows = MyShadowCursorWindow.class)
public void shouldPreferCustomShadows() {
    assertThat(ConfigurationRegistry.get(Mode.class)).isSameInstanceAs(Mode.NATIVE);
    try (CursorWindow cursorWindow = new CursorWindow("3")) {
        ShadowCursorWindow shadow = Shadow.extract(cursorWindow);
        assertThat(shadow).isInstanceOf(MyShadowCursorWindow.class);
    }
}
Also used : ShadowLegacyCursorWindow(org.robolectric.shadows.ShadowLegacyCursorWindow) ShadowCursorWindow(org.robolectric.shadows.ShadowCursorWindow) CursorWindow(android.database.CursorWindow) ShadowNativeCursorWindow(org.robolectric.shadows.ShadowNativeCursorWindow) ShadowCursorWindow(org.robolectric.shadows.ShadowCursorWindow) Test(org.junit.Test) Config(org.robolectric.annotation.Config) SQLiteMode(org.robolectric.annotation.SQLiteMode)

Aggregations

CursorWindow (android.database.CursorWindow)3 Test (org.junit.Test)3 SQLiteMode (org.robolectric.annotation.SQLiteMode)3 ShadowCursorWindow (org.robolectric.shadows.ShadowCursorWindow)3 ShadowLegacyCursorWindow (org.robolectric.shadows.ShadowLegacyCursorWindow)3 ShadowNativeCursorWindow (org.robolectric.shadows.ShadowNativeCursorWindow)3 Config (org.robolectric.annotation.Config)1