@Test public void test01CheckChildIsLinearLayout() { FrameLayout frame = (FrameLayout) Helpers.findViewByIdString(activity, "activity_pace_calculator"); assertThat(frame, notNullValue()); assertThat(frame.getChildCount(), equalTo(1)); assertThat(frame.getChildAt(0), instanceOf(LinearLayout.class)); }
@Test public void test04CheckPaceCalculation() { EditText inputDistance = (EditText) Helpers.findViewByIdString(activity, "input_distance"); EditText inputTimeMin = (EditText) Helpers.findViewByIdString(activity, "input_time_min"); EditText inputTimeSec = (EditText) Helpers.findViewByIdString(activity, "input_time_sec"); EditText inputPaceMin = (EditText) Helpers.findViewByIdString(activity, "input_pace_min"); EditText inputPaceSec = (EditText) Helpers.findViewByIdString(activity, "input_pace_sec"); Button buttonCalculate = (Button) Helpers.findViewByIdString(activity, "button_calculate"); assertThat(inputDistance, notNullValue()); assertThat(inputTimeMin, notNullValue()); assertThat(inputTimeSec, notNullValue()); assertThat(inputPaceMin, notNullValue()); assertThat(inputPaceSec, notNullValue()); assertThat(buttonCalculate, notNullValue()); inputDistance.setText("3.1"); inputTimeMin.setText("23"); inputTimeSec.setText("22"); buttonCalculate.callOnClick(); Assertions.assertThat(inputPaceMin).containsText("7"); Assertions.assertThat(inputPaceSec).containsText("32"); }