void format(NamespaceInfo nsInfo, boolean force) throws IOException {
    Preconditions.checkState(nsInfo.getNamespaceID() != 0,
        "can't format with uninitialized namespace info: %s",
        nsInfo);
    LOG.info("Formatting journal id : " + journalId + " with namespace info: " +
        nsInfo + " and force: " + force);
    storage.format(nsInfo, force);
    this.cache = createCache();
    refreshCachedData();
  }
@Test
  public void testFormatNonEmptyStorageDirectories() throws Exception {
    try {
      // Format again here and to format the non-empty directories in
      // journal node.
      journal.format(FAKE_NSINFO, false);
      fail("Did not fail to format non-empty directories in journal node.");
    } catch (IOException ioe) {
      GenericTestUtils.assertExceptionContains(
          "Can't format the storage directory because the current "
              + "directory is not empty.", ioe);
    }
  }