### Question:
Pair implements Serializable { @Override public boolean equals(Object o) { if (!(o instanceof Pair)) { return false; } @SuppressWarnings("unchecked") Pair<A,B> other = (Pair<A,B>) o; return Objects.equals(first, other.first) && Objects.equals(second, other.second); } Pair(A first, B second); A getFirst(); B getSecond(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }### Answer:
@Test public void testEquals() { assertEquals(new Pair<>(3.0, "foo"), new Pair<>(3.0, "foo")); assertEquals(new Pair<>(null, null), new Pair<>(null, null)); assertNotEquals(new Pair<>(3.0, "foo"), new Pair<>(4.0, "foo")); assertNotEquals(new Pair<>(3.0, "foo"), new Pair<>("foo", 3.0)); assertNotEquals("3.0,foo", new Pair<>(3.0, "foo")); }