コード例 #1
0
 @Test
 public void whenDeletingLastSavedStop_itShouldCommitEmptyString() {
   when(settings.getString("saved_stops", "")).thenReturn("1_456");
   subject.deleteSavedStop("1_456");
   verify(editor).putString("saved_stops", "");
   verify(editor).apply();
 }
コード例 #2
0
 @Test
 public void whenDeletingANotSavedStop_itShouldDoNothing() {
   when(settings.getString("saved_stops", "")).thenReturn("1_123,1_456,1_789");
   subject.deleteSavedStop("1_589");
   verify(editor, times(1)).putString("saved_stops", "1_123,1_456,1_789");
   verify(editor, times(1)).apply();
 }
コード例 #3
0
 @Test
 public void whenDeletingAnExistingStop_itShouldDeleteFromSettings() {
   when(settings.getString("saved_stops", "")).thenReturn("1_123,1_456,1_789");
   subject.deleteSavedStop("1_456");
   verify(editor).putString("saved_stops", "1_123,1_789");
   verify(editor).apply();
 }