@Test public void UserNotifierSnackbarTimeConversionTest() throws Exception{ TestUserNotifier notifier = new TestUserNotifier(); final String []messageText = {"test", "test2", "testtest\ntest"}; final int[] duration = {1000, Snackbar.LENGTH_SHORT, Snackbar.LENGTH_LONG}; final String []id = {"A", "B", "C"}; for (int i=0; i<3; i++){ notifier.notifyUser(messageText[i], duration[i], id[i]); assertEquals(messageText[i], notifier.getLastMessage()); if(duration[i] == Snackbar.LENGTH_SHORT) assertEquals(TestUserNotifier.DURATION_SHORT, notifier.getLastDuration()); if(duration[i] == Snackbar.LENGTH_LONG) assertEquals(TestUserNotifier.DURATION_LONG, notifier.getLastDuration()); assertEquals(id[i], notifier.getLastId()); } }
public void notifyUser(String text, int duration, String id){ if(duration == Snackbar.LENGTH_SHORT) duration = 2000; else if (duration == Snackbar.LENGTH_LONG) duration = 3500; displayMessage(text, duration, id); }
UserNotifier { public void notifyUser(String text, int duration, String id){ if(duration == Snackbar.LENGTH_SHORT) duration = 2000; else if (duration == Snackbar.LENGTH_LONG) duration = 3500; displayMessage(text, duration, id); } }
UserNotifier { public void notifyUser(String text, int duration, String id){ if(duration == Snackbar.LENGTH_SHORT) duration = 2000; else if (duration == Snackbar.LENGTH_LONG) duration = 3500; displayMessage(text, duration, id); }  }
UserNotifier { public void notifyUser(String text, int duration, String id){ if(duration == Snackbar.LENGTH_SHORT) duration = 2000; else if (duration == Snackbar.LENGTH_LONG) duration = 3500; displayMessage(text, duration, id); }  void notifyUser(String text, int duration, String id); }
UserNotifier { public void notifyUser(String text, int duration, String id){ if(duration == Snackbar.LENGTH_SHORT) duration = 2000; else if (duration == Snackbar.LENGTH_LONG) duration = 3500; displayMessage(text, duration, id); }  void notifyUser(String text, int duration, String id);  }