protected static void assertContentEquals(byte[] expected, RegularFile actual) {
      assertEquals(expected.length, actual.sizeWithoutLocking());
      byte[] actualBytes = new byte[(int) actual.sizeWithoutLocking()];
      int unused = actual.read(0, ByteBuffer.wrap(actualBytes));
      assertArrayEquals(expected, actualBytes);
    }
Actual test cases for testing RegularFiles.
jimfs/src/test/java/com/google/common/jimfs/RegularFileTest.java