@Test
public void initViewsを呼ぶとボタンのListenerが設定される() {

    //モックオブジェクトの用意
    EditText weightText = mock(EditText.class);
    EditText heightText = mock(EditText.class);
    TextView resultText = mock(TextView.class);
    Button resultButton = mock(Button.class);
    View.OnClickListener buttonListener = mock(View.OnClickListener.class);
    //モックオブジェクトを返却するように設定
    MainActivity activity = spy(new MainActivity());
    when(activity.findViewById(R.id.text_weight)).thenReturn(weightText);
    when(activity.findViewById(R.id.text_height)).thenReturn(heightText);
    when(activity.findViewById(R.id.text_result)).thenReturn(resultText);
    when(activity.findViewById(R.id.button_calculate)).thenReturn(resultButton);
    when(activity.createButtonListener(weightText, heightText, resultText)).thenReturn(buttonListener);
    //テストと検証
    activity.initViews();
    verify(activity, times(1)).createButtonListener(weightText, heightText, resultText);
    verify(resultButton, times(1)).setOnClickListener(buttonListener);
}