### Question:
RedBlackTree { public void deleteEntry(RedBlackNode<K,V> p) { size--; if (p.left != null && p.right != null) { RedBlackNode<K,V> node = p.getSuccessor(); swapPosition(node, p); } RedBlackNode<K,V> replacement = (p.left != null ? p.left : p.right); if (replacement != null) { replacement.parent = p.parent; if (p.parent == null) { root = replacement; } else if (p.isLeftChild()) { p.parent.left = replacement; } else { p.parent.right = replacement; } p.left = p.right = p.parent = null; if (p.color == BLACK) { fixAfterDeletion(replacement); } } else if (p.parent == null) { root = null; } else { if (p.color == BLACK) { fixAfterDeletion(p); } if (p.parent != null) { if (p.isLeftChild()) { p.parent.left = null; } else if (p == p.parent.right) { p.parent.right = null; } p.parent = null; } } } RedBlackTree(Comparator<K> comparator, boolean allowDuplicateKeys);  RedBlackTree(RedBlackTree<K, V> tree); @Override String toString(); int size(); boolean containsKey(K key); RedBlackNode<K,V> getFirst(); RedBlackNode<K,V> getLast(); RedBlackNode<K,V> lowerBound(K key); RedBlackNode<K,V> upperBound(K key); Pair<RedBlackNode<K, V>, Boolean> put(K key, V value); RedBlackNode<K,V> findFirstNode(K key); RedBlackNode<K,V> findLastNode(K key); V remove(K key); void removeAll(); boolean isEmpty(); void deleteEntry(RedBlackNode<K,V> p); static final String EOL; }### Answer:
@Test public void testDeleteEntry() { RedBlackNode<Integer, String> node = treeWithDups.findFirstNode(5); node = node.getSuccessor(); treeWithDups.deleteEntry(node); node = treeWithDups.findFirstNode(5); node = node.getSuccessor(); assertEquals("five-b", node.value); }