@Test
  public void testScanWrongColumnFamily() {
    final Exception e = assertThrows(Exception.class,
      () -> TraceUtil.trace(
        () -> doScan(createScan().addFamily(Bytes.toBytes("WrongColumnFamily")), -1),
        testName.getMethodName()));
    // hamcrest generic enforcement for `anyOf` is a pain; skip it
    // but -- don't we always unwrap ExecutionExceptions -- bug?
    if (e instanceof NoSuchColumnFamilyException) {
      final NoSuchColumnFamilyException ex = (NoSuchColumnFamilyException) e;
      assertThat(ex, isA(NoSuchColumnFamilyException.class));
    } else if (e instanceof ExecutionException) {
      final ExecutionException ex = (ExecutionException) e;
      assertThat(ex, allOf(isA(ExecutionException.class),
        hasProperty("cause", isA(NoSuchColumnFamilyException.class))));
    } else {
      fail("Found unexpected Exception " + e);
    }
    assertTraceError(anyOf(
      containsEntry(is(HBaseSemanticAttributes.EXCEPTION_TYPE),
        endsWith(NoSuchColumnFamilyException.class.getName())),
      allOf(
        containsEntry(is(HBaseSemanticAttributes.EXCEPTION_TYPE),
          endsWith(RemoteWithExtrasException.class.getName())),
        containsEntry(is(HBaseSemanticAttributes.EXCEPTION_MESSAGE),
          containsString(NoSuchColumnFamilyException.class.getName())))));
  }
Used by implementation classes to assert the correctness of spans having errors.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableScan.java