package com.github.davidmoten.rx2.util;

import org.junit.Assert;
import org.junit.Test;

public class PairTest {

    @Test
    public void testValues() {
        Pair<Integer, Integer> p = Pair.create(1, 2);
        Assert.assertEquals(1, (int) p.a());
        Assert.assertEquals(1, (int) p.left());
        Assert.assertEquals(1, (int) p._1());
        Assert.assertEquals(2, (int) p.b());
        Assert.assertEquals(2, (int) p.right());
        Assert.assertEquals(2, (int) p._2());
    }

    @Test
    public void testHashCode() {
        Assert.assertEquals(994, Pair.create(1, 2).hashCode());
    }

    @Test
    public void testHashCodeWithNulls() {
        Assert.assertEquals(961, Pair.create(null, null).hashCode());
    }

    @Test
    public void testToString() {
        Assert.assertEquals("Pair [left=1, right=2]", Pair.create(1, 2).toString());
    }
}

@@ -34,16 +34,104 @@
 .util;%0A%0A
+import static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0A
 import o
@@ -953,11 +953,1037 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testEquals() %7B%0A        Pair%3CInteger, Integer%3E a = Pair.create(1, 2);%0A        Pair%3CInteger, Integer%3E b = Pair.create(1, 2);%0A        Pair%3CInteger, Integer%3E c = Pair.create(1, 3);%0A        Pair%3CInteger, Integer%3E d = Pair.create(3, 2);%0A        Pair%3CInteger, Integer%3E e = Pair.create(3, 4);%0A        Pair%3CInteger, Integer%3E f = Pair.create(1, null);%0A        Pair%3CInteger, Integer%3E g = Pair.create(null, 2);%0A        Pair%3CInteger, Integer%3E h = Pair.create(null, null);%0A        Pair%3CInteger, Integer%3E i = Pair.create(null, null);%0A        assertTrue(a.equals(b));%0A        assertTrue(a.equals(a));%0A        assertFalse(a.equals(c));%0A        assertFalse(a.equals(d));%0A        assertFalse(a.equals(e));%0A        assertFalse(a.equals(null));%0A        assertFalse(a.equals(f));%0A        assertFalse(a.equals(g));%0A        assertFalse(a.equals(1));%0A        assertTrue(f.equals(f));%0A        assertTrue(g.equals(g));%0A        assertFalse(f.equals(a));%0A        assertFalse(g.equals(a));%0A        assertTrue(h.equals(i));%0A    %7D
 %0A%7D%0A

add coverage of Pair.equals