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