### Question:
IdentityMatcher implements Predicate<OpenNode<? extends E, ?>> { @Override public boolean equals(Object o) { if (o == null) { return false; } else if (o == this) { return true; } else if (o.getClass().equals(getClass())) { @SuppressWarnings("unchecked") final IdentityMatcher<E> matcher = (IdentityMatcher<E>)o; return matcher.value == value; } else { return false; } } IdentityMatcher(E value); @Override boolean test(OpenNode<? extends E, ?> node); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testEquals() { final String element = "a"; final Predicate<OpenNode<? extends String, ?>> matcher0 = new IdentityMatcher<>(element); final Predicate<OpenNode<? extends String, ?>> matcher1 = new IdentityMatcher<>(element); assertTrue(matcher0.equals(matcher1)); assertTrue(matcher1.equals(matcher0)); assertEquals(matcher0.hashCode(), matcher1.hashCode()); }
@Test public void testEqualsSelf() { final String element = "a"; final Predicate<OpenNode<? extends String, ?>> matcher0 = new IdentityMatcher<>(element); assertTrue(matcher0.equals(matcher0)); }
@Test public void testNotEquals0() { final Predicate<OpenNode<? extends String, ?>> matcher0 = new IdentityMatcher<>(new String("a")); final Predicate<OpenNode<? extends String, ?>> matcher1 = new IdentityMatcher<>(new String("a")); assertFalse(matcher0.equals(matcher1)); }
@Test public void testNotEquals1() { final Predicate<OpenNode<? extends String, ?>> matcher0 = new IdentityMatcher<>(new String("a")); assertFalse(matcher0.equals(null)); }
@Test public void testNotEquals2() { final Predicate<OpenNode<? extends String, ?>> matcher0 = new IdentityMatcher<>(new String("a")); assertFalse(matcher0.equals(new Object())); }