1package com.xtremelabs.robolectric.shadows; 2 3import static org.junit.Assert.assertEquals; 4import static org.junit.Assert.assertNotNull; 5import android.app.Activity; 6import android.widget.Toast; 7 8import com.xtremelabs.robolectric.WithTestDefaultsRunner; 9 10import org.junit.Test; 11import org.junit.runner.RunWith; 12 13@RunWith(WithTestDefaultsRunner.class) 14public class ToastTest { 15 16 @Test 17 public void shouldHaveShortDuration() throws Exception { 18 Toast toast = Toast.makeText(new Activity(), "short toast", 19 Toast.LENGTH_SHORT); 20 assertNotNull(toast); 21 assertEquals(Toast.LENGTH_SHORT, toast.getDuration()); 22 } 23 24 @Test 25 public void shouldHaveLongDuration() throws Exception { 26 Toast toast = Toast.makeText(new Activity(), "long toast", 27 Toast.LENGTH_LONG); 28 assertNotNull(toast); 29 assertEquals(Toast.LENGTH_LONG, toast.getDuration()); 30 } 31} 32