### Question:
UnorderedPair extends SameTypePair<T> { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof UnorderedPair) { UnorderedPair that = (UnorderedPair) obj; return (Objects.equals(first(), that.first()) && Objects.equals(second(), that.second())) || (Objects.equals(first(), that.second()) && Objects.equals(second(), that.first())); } return false; } UnorderedPair(T first, T second); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void equalPairsShouldBeEqual() { assertTrue(new UnorderedPair<>("test", "test").equals(new UnorderedPair<>("test", "test"))); assertTrue(new UnorderedPair<>("test1", "test").equals(new UnorderedPair<>("test", "test1"))); assertTrue(new UnorderedPair<>(null, "test").equals(new UnorderedPair<>(null, "test"))); assertTrue(new UnorderedPair<>(null, "test").equals(new UnorderedPair<>("test", null))); assertTrue(new UnorderedPair<>("test", null).equals(new UnorderedPair<>("test", null))); assertTrue(new UnorderedPair<>("test", null).equals(new UnorderedPair<>(null, "test"))); assertTrue(new UnorderedPair<>(null, null).equals(new UnorderedPair<>(null, null))); }
@Test public void unEqualPairsShouldNotBeEqual() { assertFalse(new UnorderedPair<>("test1", "test2").equals(new UnorderedPair<>("test1", "test1"))); assertFalse(new UnorderedPair<>("test1", "test1").equals(new UnorderedPair<>(null, "test1"))); assertFalse(new UnorderedPair<>("test1", null).equals(new UnorderedPair<>("test1", "test1"))); assertFalse(new UnorderedPair<>(null, null).equals(new UnorderedPair<>("test1", "test1"))); assertFalse(new UnorderedPair<>("test1", "test1").equals(new UnorderedPair<>("test1", null))); assertFalse(new UnorderedPair<>("test1", "test1").equals(new UnorderedPair<>(null, null))); }