java 物质主义#28~35

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 物质主义#28~35相关的知识,希望对你有一定的参考价值。

@SuppressLint("SetTextI18n")

@Test
public void testSuccessful() {
    ((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
    ((EditText) activity.findViewById(R.id.edittext_body)).setText("body");
    activity.findViewById(R.id.feedback_button).performClick();
    verify(feedbackClient).send(eq("title"), eq("body"), callback.capture());
    callback.getValue().onSent(true);
    assertThat(activity).isFinishing();
    assertEquals(activity.getString(R.string.feedback_sent), ShadowToast.getTextOfLatestToast());
    controller.pause().stop().destroy();
}

@Test
public void testFailed() {
    ((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
    ((EditText) activity.findViewById(R.id.edittext_body)).setText("body");
    activity.findViewById(R.id.feedback_button).performClick();
    verify(feedbackClient).send(eq("title"), eq("body"), callback.capture());
    callback.getValue().onSent(false);
    assertThat(activity).isNotFinishing();
    assertEquals(activity.getString(R.string.feedback_failed), ShadowToast.getTextOfLatestToast());
    controller.pause().stop().destroy();
}

@Test
public void testDismissBeforeResult() {
    ((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
    ((EditText) activity.findViewById(R.id.edittext_body)).setText("body");
    activity.findViewById(R.id.feedback_button).performClick();
    verify(feedbackClient).send(eq("title"), eq("body"), callback.capture());
    activity.finish();
    callback.getValue().onSent(true);
    controller.pause().stop().destroy();
}

@Test
public void testFinishBeforeResult() {
    ((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
    ((EditText) activity.findViewById(R.id.edittext_body)).setText("body");
    activity.findViewById(R.id.feedback_button).performClick();
    verify(feedbackClient).send(eq("title"), eq("body"), callback.capture());
    controller.pause().stop().destroy();
    callback.getValue().onSent(true);
}

以上是关于java 物质主义#28~35的主要内容,如果未能解决你的问题,请参考以下文章

java 物质主义#23~25

java 物质主义#10〜#22

java 物质主义#09

java 物质主义#07

java 物质主义#05

java 物质主义#04