public static Matcher<byte[]> bytesAsStringBinary(final Matcher<String> matcher) {
    return new TypeSafeDiagnosingMatcher<byte[]>() {
      @Override
      protected boolean matchesSafely(byte[] item, Description mismatchDescription) {
        final String binary = Bytes.toStringBinary(item);
        if (matcher.matches(binary)) {
          return true;
        }
        mismatchDescription.appendText("was a byte[] with a Bytes.toStringBinary value ");
        matcher.describeMismatch(binary, mismatchDescription);
        return false;
      }

      @Override
      public void describeTo(Description description) {
        description.appendText("has a byte[] with a Bytes.toStringBinary value that ")
          .appendDescriptionOf(matcher);
      }
    };
  }
Helper methods for matching against values passed through the helper methods of {@link Bytes}.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/hamcrest/BytesMatchers.java