@Test
  public void testProgrammaticDependencies() throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    MockDependencyMonitor mockDependencyMonitor = new MockDependencyMonitor();
    DependencyMonitorManager.addMonitor(mockDependencyMonitor);

    Thread thread1 = startAThread(latch);
    Thread thread2 = startAThread(latch);

    String resource1 = "one";
    String resource2 = "two";

    mockDependencyMonitor.addDependency(thread1, resource1);
    mockDependencyMonitor.addDependency(resource1, thread2);
    mockDependencyMonitor.addDependency(thread2, resource2);
    mockDependencyMonitor.addDependency(resource2, thread1);

    DeadlockDetector detector = new DeadlockDetector();
    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
    LinkedList<Dependency> deadlocks = detector.findDeadlock();

    System.out.println("deadlocks=" + deadlocks);

    assertEquals(4, deadlocks.size());

    latch.countDown();
    DependencyMonitorManager.removeMonitor(mockDependencyMonitor);
  }
Test that the deadlock detector will find deadlocks that are reported by the
{@link DependencyMonitorManager}
geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/deadlock/DeadlockDetectorTest.java