@Test
  public void testDoubleLoadingAndPriorityValue() {
    final Configuration conf = HBaseConfiguration.create();
    final String key = "KEY";
    final String coprocessor = "org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver";

    CoprocessorHost<RegionCoprocessor, CoprocessorEnvironment<RegionCoprocessor>> host;
    host = new CoprocessorHostForTest<>(conf);
    int overridePriority = Integer.MAX_VALUE - 1;

    final String coprocessor_v3 = SimpleRegionObserverV3.class.getName() + "|" + overridePriority;

    // Try and load a coprocessor three times
    conf.setStrings(key, coprocessor, coprocessor, coprocessor,
      SimpleRegionObserverV2.class.getName(), coprocessor_v3);
    host.loadSystemCoprocessors(conf, key);

    // Three coprocessors(SimpleRegionObserver, SimpleRegionObserverV2,
    // SimpleRegionObserverV3) loaded
    Assert.assertEquals(3, host.coprocEnvironments.size());

    // Check the priority value
    CoprocessorEnvironment<?> simpleEnv =
      host.findCoprocessorEnvironment(SimpleRegionObserver.class.getName());
    CoprocessorEnvironment<?> simpleEnv_v2 =
      host.findCoprocessorEnvironment(SimpleRegionObserverV2.class.getName());
    CoprocessorEnvironment<?> simpleEnv_v3 =
      host.findCoprocessorEnvironment(SimpleRegionObserverV3.class.getName());

    assertNotNull(simpleEnv);
    assertNotNull(simpleEnv_v2);
    assertNotNull(simpleEnv_v3);
    assertEquals(Coprocessor.PRIORITY_SYSTEM, simpleEnv.getPriority());
    assertEquals(Coprocessor.PRIORITY_SYSTEM + 1, simpleEnv_v2.getPriority());
    assertEquals(overridePriority, simpleEnv_v3.getPriority());
  }
An {@link Abortable} implementation for tests.
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorHost.java