@Test
  public void testFileStore() throws IOException {
    FileStore fileStore = Iterables.getOnlyElement(fs.getFileStores());
    assertThat(fileStore.name()).isEqualTo("jimfs");
    assertThat(fileStore.type()).isEqualTo("jimfs");
    assertThat(fileStore.isReadOnly()).isFalse();

    long totalSpace = 1024 * 1024 * 1024; // 1 GB
    assertThat(fileStore.getTotalSpace()).isEqualTo(totalSpace);
    assertThat(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace);
    assertThat(fileStore.getUsableSpace()).isEqualTo(totalSpace);

    Files.write(fs.getPath("/foo"), new byte[10000]);

    assertThat(fileStore.getTotalSpace()).isEqualTo(totalSpace);

    // We wrote 10000 bytes, but since the file system allocates fixed size blocks, more than 10k
    // bytes may have been allocated. As such, the unallocated space after the write can be at most
    // maxUnallocatedSpace.
    assertThat(fileStore.getUnallocatedSpace() <= totalSpace - 10000).isTrue();

    // Usable space is at most unallocated space. (In this case, it's currently exactly unallocated
    // space, but that's not required.)
    assertThat(fileStore.getUsableSpace() <= fileStore.getUnallocatedSpace()).isTrue();

    Files.delete(fs.getPath("/foo"));
    assertThat(fileStore.getTotalSpace()).isEqualTo(totalSpace);
    assertThat(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace);
    assertThat(fileStore.getUsableSpace()).isEqualTo(totalSpace);
  }
Tests an in-memory file system through the public APIs in {@link Files}, etc. This also acts as
the tests for {@code FileSystemView}, as each public API method is (mostly) implemented by a
method in {@code FileSystemView}.

<p>These tests uses a Unix-like file system, but most of what they test applies to any file
system configuration.

@author Colin Decker
jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java