@Test public void checkIfUsernameIsSetCorrectly() { presenter.showIfLoggedIn(); verify(view).showIfLoggedIn(anyInt(), anyInt(), (String) any()); }
@Override public void showIfLoggedIn() { boolean loggedIn = preferences.getBooleanPreference(PreferenceList.LOGGED_IN_TO_OSM); int message; int button; String userName = getUserName(); if (loggedIn) { if ("".equals(userName)) { message = R.string.logged_in; } else { message = R.string.logged_in_as; } button = R.string.log_out; } else { message = R.string.not_logged_in; button = R.string.authorise_openstreetmap; } view.showIfLoggedIn(message, button, userName); }
MainActivityPresenter implements MainActivityContract.Presenter { @Override public void showIfLoggedIn() { boolean loggedIn = preferences.getBooleanPreference(PreferenceList.LOGGED_IN_TO_OSM); int message; int button; String userName = getUserName(); if (loggedIn) { if ("".equals(userName)) { message = R.string.logged_in; } else { message = R.string.logged_in_as; } button = R.string.log_out; } else { message = R.string.not_logged_in; button = R.string.authorise_openstreetmap; } view.showIfLoggedIn(message, button, userName); } }
MainActivityPresenter implements MainActivityContract.Presenter { @Override public void showIfLoggedIn() { boolean loggedIn = preferences.getBooleanPreference(PreferenceList.LOGGED_IN_TO_OSM); int message; int button; String userName = getUserName(); if (loggedIn) { if ("".equals(userName)) { message = R.string.logged_in; } else { message = R.string.logged_in_as; } button = R.string.log_out; } else { message = R.string.not_logged_in; button = R.string.authorise_openstreetmap; } view.showIfLoggedIn(message, button, userName); } MainActivityPresenter(MainActivityContract.View view, SourceContract.Preferences preferences); }
MainActivityPresenter implements MainActivityContract.Presenter { @Override public void showIfLoggedIn() { boolean loggedIn = preferences.getBooleanPreference(PreferenceList.LOGGED_IN_TO_OSM); int message; int button; String userName = getUserName(); if (loggedIn) { if ("".equals(userName)) { message = R.string.logged_in; } else { message = R.string.logged_in_as; } button = R.string.log_out; } else { message = R.string.not_logged_in; button = R.string.authorise_openstreetmap; } view.showIfLoggedIn(message, button, userName); } MainActivityPresenter(MainActivityContract.View view, SourceContract.Preferences preferences); @Override void showIfLoggedIn(); @Override void checkIfOauth(URI uri); void onButtonClicked(); @Override void toggleDebugMode(); @Override String getUserName(); @Override void savePoiList(); @Override void restorePoiList(); }
MainActivityPresenter implements MainActivityContract.Presenter { @Override public void showIfLoggedIn() { boolean loggedIn = preferences.getBooleanPreference(PreferenceList.LOGGED_IN_TO_OSM); int message; int button; String userName = getUserName(); if (loggedIn) { if ("".equals(userName)) { message = R.string.logged_in; } else { message = R.string.logged_in_as; } button = R.string.log_out; } else { message = R.string.not_logged_in; button = R.string.authorise_openstreetmap; } view.showIfLoggedIn(message, button, userName); } MainActivityPresenter(MainActivityContract.View view, SourceContract.Preferences preferences); @Override void showIfLoggedIn(); @Override void checkIfOauth(URI uri); void onButtonClicked(); @Override void toggleDebugMode(); @Override String getUserName(); @Override void savePoiList(); @Override void restorePoiList();  }