use of org.robolectric.shadows.ShadowContentObserver in project materialistic by hidroh.
the class FavoriteActivityTest method testRemoveClearSelection.
@Test
public void testRemoveClearSelection() {
ShadowContentObserver observer = shadowOf(shadowOf(activity.getContentResolver()).getContentObservers(MaterialisticProvider.URI_FAVORITE).iterator().next());
observer.dispatchChange(false, MaterialisticProvider.URI_FAVORITE.buildUpon().appendPath("remove").appendPath("3").build());
assertNull(activity.getSelectedItem());
activity.onItemSelected(new TestHnItem(1L));
observer.dispatchChange(false, MaterialisticProvider.URI_FAVORITE.buildUpon().appendPath("remove").appendPath("2").build());
assertNotNull(activity.getSelectedItem());
observer.dispatchChange(false, MaterialisticProvider.URI_FAVORITE.buildUpon().appendPath("remove").appendPath("1").build());
assertNull(activity.getSelectedItem());
}
Aggregations