### Question:
DependencyGraph { public void addDependency(T from, T to) { if (from == null || to == null || from.equals(to)) { throw new IllegalArgumentException("Invalid parameters"); } lock.writeLock().lock(); try { if (addOutgoingEdge(from, to)) { addIncomingEdge(to, from); } } finally { lock.writeLock().unlock(); } }  List<T> topologicalSort(); void addDependency(T from, T to); void removeDependency(T from, T to); void clearAll(); boolean hasDependent(T element); Set<T> getDependents(T element); void remove(T element);  }### Answer:
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddSelf() { new DependencyGraph<>().addDependency("N", "N"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAdNull() { new DependencyGraph<>().addDependency("N", null); }