SortHelper { public boolean saveSortByPreference(Sort sort) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString( PREF_SORT_BY_KEY, sort.toString() ); return editor.commit(); } @Inject  SortHelper(SharedPreferences sharedPreferences); Sort getSortByPreference(); Uri getSortedMoviesUri(); boolean saveSortByPreference(Sort sort);  }
@Test public void testSaveSortByPreference() throws Exception { sort = Sort.HIGHEST_RATED; mockSortHelper = createMockSharedPreference(); mockSortHelper.saveSortByPreference(sort); assertEquals(sort, mockSortHelper.getSortByPreference()); }