@Test
  public void testClose_resourcesThatThrowOnClose() {
    List<TestCloseable> resources =
        ImmutableList.of(
            new TestCloseable(),
            new ThrowsOnClose("a"),
            new TestCloseable(),
            new ThrowsOnClose("b"),
            new ThrowsOnClose("c"),
            new TestCloseable(),
            new TestCloseable());
    for (TestCloseable resource : resources) {
      state.register(resource);
      assertFalse(resource.closed);
    }

    try {
      state.close();
      fail();
    } catch (IOException expected) {
      Throwable[] suppressed = expected.getSuppressed();
      assertEquals(2, suppressed.length);
      ImmutableSet<String> messages =
          ImmutableSet.of(
              expected.getMessage(), suppressed[0].getMessage(), suppressed[1].getMessage());
      assertEquals(ImmutableSet.of("a", "b", "c"), messages);
    }

    for (TestCloseable resource : resources) {
      assertTrue(resource.closed);
    }
  }
Tests for {@link FileSystemState}.

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