@Test
  @SuppressWarnings("unchecked")
  public void testLoadFilesWithRecoverableBadFiles() throws Exception {
    // In L0, there will be file w/o metadata (real L0, 3 files with invalid metadata, and 3
    // files that overlap valid stripes in various ways). Note that the 4th way to overlap the
    // stripes will cause the structure to be mostly scraped, and is tested separately.
    ArrayList<HStoreFile> validStripeFiles = al(createFile(OPEN_KEY, KEY_B),
      createFile(KEY_B, KEY_C), createFile(KEY_C, OPEN_KEY), createFile(KEY_C, OPEN_KEY));
    ArrayList<HStoreFile> filesToGoToL0 = al(createFile(), createFile(null, KEY_A),
      createFile(KEY_D, null), createFile(KEY_D, KEY_A), createFile(keyAfter(KEY_A), KEY_C),
      createFile(OPEN_KEY, KEY_D), createFile(KEY_D, keyAfter(KEY_D)));
    ArrayList<HStoreFile> allFilesToGo = flattenLists(validStripeFiles, filesToGoToL0);
    Collections.shuffle(allFilesToGo);
    StripeStoreFileManager manager = createManager(allFilesToGo);
    List<HStoreFile> l0Files = manager.getLevel0Files();
    assertEquals(filesToGoToL0.size(), l0Files.size());
    for (HStoreFile sf : filesToGoToL0) {
      assertTrue(l0Files.contains(sf));
    }
    verifyAllFiles(manager, allFilesToGo);
  }
Verifies scenario for finding a split point.
@param splitPointAfter    Stripe to expect the split point at/after.
@param shouldSplitStripe  If true, the split point is expected in the middle of the above
                          stripe; if false, should be at the end.
@param splitRatioToVerify Maximum split imbalance ratio.
@param sizes              Stripe sizes.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeStoreFileManager.java