1 package org.robolectric.shadows; 2 3 import static org.assertj.core.api.Assertions.assertThat; 4 5 import android.util.Pair; 6 import org.junit.Test; 7 import org.junit.runner.RunWith; 8 import org.robolectric.RobolectricTestRunner; 9 10 @RunWith(RobolectricTestRunner.class) 11 public class ShadowPairTest { 12 13 @Test 14 public void testConstructor() throws Exception { 15 Pair<String, Integer> pair = new Pair<>("a", 1); 16 assertThat(pair.first).isEqualTo("a"); 17 assertThat(pair.second).isEqualTo(1); 18 } 19 20 @Test 21 public void testStaticCreate() throws Exception { 22 Pair<String, String> p = Pair.create("Foo", "Bar"); 23 assertThat(p.first).isEqualTo("Foo"); 24 assertThat(p.second).isEqualTo("Bar"); 25 } 26 27 @Test 28 public void testEquals() throws Exception { 29 assertThat(Pair.create("1", 2)).isEqualTo(Pair.create("1", 2)); 30 } 31 32 @Test 33 public void testHash() throws Exception { 34 assertThat(Pair.create("1", 2).hashCode()).isEqualTo(Pair.create("1", 2).hashCode()); 35 } 36 } 37