@Test
  public void testDistributedDeadlockWithFunction() throws Exception {
    FileBasedCountDownLatch countDownLatch = new FileBasedCountDownLatch(2);

    // This thread locks the lock in server1 first, then server2.
    lockTheLocks(server1, server2, countDownLatch);
    // This thread locks the lock server2 first, then server1.
    lockTheLocks(server2, server1, countDownLatch);

    await()
        .untilAsserted(() -> {
          gfsh.executeAndAssertThat(showDeadlockCommand).statusIsSuccess();
          String commandOutput = gfsh.getGfshOutput();
          assertThat(commandOutput).startsWith(CliStrings.SHOW_DEADLOCK__DEADLOCK__DETECTED);
          assertThat(outputFile).exists();
        });
  }
Distributed test base for show deadlock command in {@link ShowDeadlockCommand}.
geode-dunit/src/main/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDistributedTestBase.java