@Test
  public void limit() {
    final String tableName = testNameRule.getMethodName();
    createTable(TableName.valueOf(tableName), 8).join();

    final HttpServletRequest request = new MockRequestBuilder().setLimit(5).build();
    final List<RegionReplicaInfo> rows;
    try (final MetaBrowser.Results results = new MetaBrowser(connection, request).getResults()) {
      rows = IterableUtils.toList(results);
    }
    assertThat(rows,
      contains(hasProperty("row", bytesAsStringBinary(startsWith(tableName + ",,"))),
        hasProperty("row", bytesAsStringBinary(startsWith(tableName + ",20000000"))),
        hasProperty("row", bytesAsStringBinary(startsWith(tableName + ",40000000"))),
        hasProperty("row", bytesAsStringBinary(startsWith(tableName + ",60000000"))),
        hasProperty("row", bytesAsStringBinary(startsWith(tableName + ",80000000")))));
  }
Cluster-backed correctness tests for the functionality provided by {@link MetaBrowser}.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/http/TestMetaBrowser.java