@Test public void shouldFindPreferences() { activity.addPreferencesFromResource(R.xml.preferences); assertNotNull(activity.findPreference("category")); assertNotNull(activity.findPreference("inside_category")); assertNotNull(activity.findPreference("screen")); assertNotNull(activity.findPreference("inside_screen")); assertNotNull(activity.findPreference("checkbox")); assertNotNull(activity.findPreference("edit_text")); assertNotNull(activity.findPreference("list")); assertNotNull(activity.findPreference("preference")); assertNotNull(activity.findPreference("ringtone")); }
@Test public void shouldLoadPreferenceScreen() { activity.addPreferencesFromResource(R.xml.preferences); assertThat(activity.getPreferenceScreen().getPreferenceCount()).isEqualTo(7); }
@Test public void shouldNotInitializePreferenceScreen() { assertThat(activity.getPreferenceScreen()).isNull(); }
@Test public void shouldRecordPreferencesResourceId() { assertThat(shadow.getPreferencesResId()).isEqualTo(-1); activity.addPreferencesFromResource(R.xml.preferences); assertThat(shadow.getPreferencesResId()).isEqualTo(R.xml.preferences); }
@Test public void shouldInitializeListViewInOnCreate() { shadow.callOnCreate(null); assertThat(activity.getListView()).isNotNull(); }