@Test
  public void testErrorPropagation() throws Exception {
    List<String> members = new ArrayList<>();
    members.add("member");
    Procedure proc = new Procedure(coord, new ForeignExceptionDispatcher(), 100, Integer.MAX_VALUE,
      "op", null, members);
    final Procedure procspy = spy(proc);

    ForeignException cause = new ForeignException("SRC", "External Exception");
    proc.receive(cause);

    // start the barrier procedure
    Thread t = new Thread() {
      @Override
      public void run() {
        procspy.call();
      }
    };
    t.start();
    t.join();

    verify(procspy, never()).sendGlobalBarrierStart();
    verify(procspy, never()).sendGlobalBarrierReached();
    verify(procspy).sendGlobalBarrierComplete();
  }
With a single member, verify ordered execution. The Coordinator side is run in a separate
thread so we can only trigger from members and wait for particular state latches.
hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestProcedure.java