@Test
  public void testReplicationPeerModificationSwitch() throws Exception {
    assertTrue(admin.isReplicationPeerModificationEnabled().get());
    // disable modification, should returns true as it is enabled by default and the above
    // assertion has confirmed it
    assertTrue(admin.replicationPeerModificationSwitch(false).get());
    ExecutionException error = assertThrows(ExecutionException.class, () -> admin
      .addReplicationPeer(ID_ONE, ReplicationPeerConfig.newBuilder().setClusterKey(KEY_ONE).build())
      .get());
    assertThat(error.getCause().getMessage(),
      containsString("Replication peer modification disabled"));
    // enable again, and the previous value should be false
    assertFalse(admin.replicationPeerModificationSwitch(true).get());
  }
Tests that admin api throws ReplicationPeerNotFoundException if peer doesn't exist.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncReplicationAdminApi.java