1 package org.robolectric.android; 2 3 import static org.assertj.core.api.Assertions.assertThat; 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 7 import android.util.Log; 8 import android.view.View; 9 import android.widget.Toast; 10 import org.junit.Test; 11 import org.junit.runner.RunWith; 12 import org.robolectric.RobolectricTestRunner; 13 import org.robolectric.RuntimeEnvironment; 14 15 @RunWith(RobolectricTestRunner.class) 16 public class ShadowingTest { 17 18 @Test 19 public void testPrintlnWorks() throws Exception { 20 Log.println(1, "tag", "msg"); 21 } 22 23 @Test 24 public void shouldDelegateToObjectToStringIfShadowHasNone() throws Exception { 25 assertThat(new Toast(RuntimeEnvironment.application).toString()).startsWith("android.widget.Toast@"); 26 } 27 28 @Test 29 public void shouldDelegateToObjectHashCodeIfShadowHasNone() throws Exception { 30 assertFalse(new View(RuntimeEnvironment.application).hashCode() == 0); 31 } 32 33 @Test 34 public void shouldDelegateToObjectEqualsIfShadowHasNone() throws Exception { 35 View view = new View(RuntimeEnvironment.application); 36 assertEquals(view, view); 37 } 38 } 39