@Test public void shouldRestoreServerUrlOnLoad() { String url = "http://dev.rapidftr.com:3000"; SharedPreferences sharedPreferences = Robolectric.application.getSharedPreferences("RAPIDFTR_PREFERENCES", Context.MODE_PRIVATE); sharedPreferences.edit().putString("SERVER_URL", "http://dev.rapidftr.com:3000").commit(); loginActivity.onCreate(null); assertThat(serverUrl.getText().toString(), equalTo(url)); }
@Before public void setUp() throws Exception { loginActivity = new LoginActivity(); loginActivity.onCreate(null); loginButton = (Button) loginActivity.findViewById(R.id.login_button); serverUrl = (EditText) loginActivity.findViewById(R.id.url); serverUrl.setText("http://dev.rapidftr.com:3000"); userName = (EditText) loginActivity.findViewById(R.id.username); userName.setText("rapidftr"); password = (EditText) loginActivity.findViewById(R.id.password); password.setText("rapidftr"); }
@Before public void setup() { loginActivity = new LoginActivity(); Intent newIntent = new Intent(); newIntent.putExtra("statusData", new StatusData(new UserProfile("User Name", ""), null)); loginActivity.setIntent(newIntent); loginActivity.onCreate(null); usernameEdit = (EditText) loginActivity.findViewById(R.id.login_screen_username_edit); passwordEdit = (EditText) loginActivity.findViewById(R.id.login_screen_password_edit); statusText = (TextView) loginActivity.findViewById(R.id.login_screen_status_text); loginButton = (Button) loginActivity.findViewById(R.id.login_screen_login_button); resetButton = (Button) loginActivity.findViewById(R.id.login_screen_reset_button); }
@Override public void onCreate(Bundle savedInstanceState) { init_(savedInstanceState); super.onCreate(savedInstanceState); setContentView(layout.activity_login); }