@Test
  @Parameters({"true, true", "true, false", "false, false"})
  public void testUnsuccessfulCancelExecution(boolean isPartitionedRegion,
      boolean isParallelGatewaySender) throws Exception {
    List<VM> serversInA = Arrays.asList(vm5, vm6, vm7);
    List<VM> serversInB = Collections.singletonList(vm3);
    VM serverInC = vm4;
    VM client = vm8;
    String senderIdInA = "B";
    String senderIdInB = "C";

    int senderLocatorPort = create3WanSitesAndClient(isPartitionedRegion, vm0,
        vm1, vm2, serversInA, serversInB, serverInC, client,
        senderIdInA, senderIdInB, true);

    String regionName = getRegionName(isPartitionedRegion);

    // Create senders and receivers
    createSender(isParallelGatewaySender, serversInA, senderIdInA, 2);
    createSender(isParallelGatewaySender, serversInB, senderIdInB, 3);
    createReceivers(serversInB, serverInC);

    // Execute cancel wan-copy region command
    gfsh.connectAndVerify(senderLocatorPort, GfshCommandRule.PortType.locator);
    String cancelCommand = new CommandStringBuilder(WAN_COPY_REGION)
        .addOption(WAN_COPY_REGION__REGION, regionName)
        .addOption(WAN_COPY_REGION__SENDERID, senderIdInA)
        .addOption(WAN_COPY_REGION__CANCEL)
        .getCommandString();

    CommandResultAssert cancelCommandResult =
        verifyStatusIsError(gfsh.executeAndAssertThat(cancelCommand), serversInA.size());
    String msg = CliStrings.format(WAN_COPY_REGION__MSG__NO__RUNNING__COMMAND,
        regionName, senderIdInA);
    cancelCommandResult
        .hasTableSection(ResultModel.MEMBER_STATUS_SECTION)
        .hasColumn("Message")
        .containsExactlyInAnyOrder(msg, msg, msg);
  }
Cancel is executed when no wan-copy region command is running.
geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java