byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
MockVFSContext context = registerSimpleVFSContext();
context.getMockRoot().setStream(bytes);
VirtualFile file = VFS.getRoot(context.getRootURI());
InputStream stream = file.openStream();
byte[] buffer = new byte[bytes.length];
stream.read(buffer);
assertTrue(stream.read() == -1);
assertTrue(Arrays.equals(bytes, buffer));