@Test
  public void testWrite() throws IOException {
    RegularFile file = regularFile(0);
    FileChannel channel = channel(file, WRITE);
    assertEquals(0, channel.position());

    ByteBuffer buf = buffer("1234567890");
    ByteBuffer buf2 = buffer("1234567890");
    assertEquals(10, channel.write(buf));
    assertEquals(10, channel.position());

    buf.flip();
    assertEquals(20, channel.write(new ByteBuffer[] {buf, buf2}));
    assertEquals(30, channel.position());

    buf.flip();
    buf2.flip();
    assertEquals(20, channel.write(new ByteBuffer[] {buf, buf2}, 0, 2));
    assertEquals(50, channel.position());

    buf.flip();
    assertEquals(10, channel.write(buf, 5));
    assertEquals(50, channel.position());
  }
Most of the behavior of {@link JimfsFileChannel} is handled by the {@link RegularFile}
implementations, so the thorough tests of that are in {@link RegularFileTest}. This mostly tests
interactions with the file and channel positions.

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