package org.robolectric.shadows;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.R;
import org.robolectric.Robolectric;
import org.robolectric.TestRunners;

import static org.fest.assertions.api.Assertions.assertThat;

@RunWith(TestRunners.WithDefaults.class)
public class ToastTest {
  @Test
  public void shouldHaveShortDuration() throws Exception {
    Toast toast = Toast.makeText(new Activity(), "short toast", Toast.LENGTH_SHORT);
    assertThat(toast).isNotNull();
    assertThat(toast.getDuration()).isEqualTo(Toast.LENGTH_SHORT);
  }

  @Test
  public void shouldHaveLongDuration() throws Exception {
    Toast toast = Toast.makeText(new Activity(), "long toast", Toast.LENGTH_LONG);
    assertThat(toast).isNotNull();
    assertThat(toast.getDuration()).isEqualTo(Toast.LENGTH_LONG);
  }

  @Test
  public void shouldSetTextCorrectly() throws Exception {
    Toast toast = Toast.makeText(new Activity(), "short toast", Toast.LENGTH_SHORT);
    assertThat(toast).isNotNull();
    assertThat(toast.getDuration()).isEqualTo(Toast.LENGTH_SHORT);
    toast.show();
    assertThat(ShadowToast.getLatestToast()).isSameAs(toast);
    assertThat(ShadowToast.getTextOfLatestToast()).isEqualTo("short toast");
    assertThat(ShadowToast.showedToast("short toast")).isTrue();
  }

  @Test
  public void shouldMakeTextCorrectly() throws Exception {
    Toast toast = Toast.makeText(new Activity(), "short toast", Toast.LENGTH_SHORT);
    toast.setText("other toast");
    toast.show();
    assertThat(ShadowToast.getLatestToast()).isSameAs(toast);
    assertThat(ShadowToast.getTextOfLatestToast()).isEqualTo("other toast");
    assertThat(ShadowToast.showedToast("other toast")).isTrue();
  }

  @Test
  public void shouldSetTextWithIdCorrectly() throws Exception {
    Toast toast = Toast.makeText(new Activity(), "short toast", Toast.LENGTH_SHORT);
    toast.setText(R.string.hello);
    toast.show();
    assertThat(ShadowToast.getLatestToast()).isSameAs(toast);
    assertThat(ShadowToast.getTextOfLatestToast()).isEqualTo("Hello");
    assertThat(ShadowToast.showedToast("Hello")).isTrue();
  }

  @Test
  public void shouldSetViewCorrectly() throws Exception {
    final Activity activity = Robolectric.buildActivity(Activity.class).create().start().resume().get();
    Toast toast = new Toast(activity);
    toast.setDuration(Toast.LENGTH_SHORT);
    final View view = new TextView(activity);
    toast.setView(view);
    assertThat(toast.getView()).isSameAs(view);
  }

  @Test
  public void shouldSetGravityCorrectly() throws Exception {
    Toast toast = Toast.makeText(new Activity(), "short toast", Toast.LENGTH_SHORT);
    assertThat(toast).isNotNull();
    toast.setGravity(Gravity.CENTER, 0, 0);
    assertThat(toast.getGravity()).isEqualTo(Gravity.CENTER);
  }

  @Test
  public void shouldCountToastsCorrectly() throws Exception {
    assertThat(ShadowToast.shownToastCount()).isEqualTo(0);
    Toast toast = Toast.makeText(new Activity(), "short toast", Toast.LENGTH_SHORT);
    assertThat(toast).isNotNull();
    toast.show();
    toast.show();
    toast.show();
    assertThat(ShadowToast.shownToastCount()).isEqualTo(3);
    ShadowToast.reset();
    assertThat(ShadowToast.shownToastCount()).isEqualTo(0);
    toast.show();
    toast.show();
    assertThat(ShadowToast.shownToastCount()).isEqualTo(2);
  }
}

@@ -994,27 +994,28 @@
  void should
-Set
+Make
 TextCorrectl
@@ -1471,36 +1471,35 @@
 blic void should
-Make
+Set
 TextCorrectly() 

Fix test method names, introduced in 53aa0e480401a10d5d67b8d35bcf900497c4a09c.