### Question:
LoadingTextView extends RelativeLayout { public void stopLoadingAndSetText(int text_res_id) { TextView textView = (TextView) findViewById(R.id.loading_text_text_view); textView.setText(text_res_id); textView.setVisibility(View.VISIBLE); findViewById(R.id.loading_text_spinner).setVisibility(View.GONE); } LoadingTextView(Context context);  LoadingTextView(Context context, AttributeSet attrs);  LoadingTextView(Context context, AttributeSet attrs, int defStyle); void stopLoadingAndSetText(int text_res_id);  }### Answer:
@Test public void testStopLoadingAndSetTextShouldHideTheSpinnerAndShowTheTextView() throws Exception { assertThat(loadingSpinner.getVisibility(), equalTo(View.VISIBLE)); assertThat(loadingTextTextView.getVisibility(), equalTo(View.INVISIBLE)); loadingTextView.stopLoadingAndSetText(R.string.unit_tests_ftw); assertThat(loadingSpinner.getVisibility(), equalTo(View.GONE)); assertThat(loadingTextTextView.getVisibility(), equalTo(View.VISIBLE)); }
@Test public void testStopLoadingAndSEtTextShouldSetTheTextOnTheTextView() { loadingTextView.stopLoadingAndSetText(R.string.unit_tests_ftw); assertThat((String) loadingTextTextView.getText(), equalTo("Unit Tests FTW!!!")); }