### Question:
GlusterFileChannel extends FileChannel { int parseOptions(Set<? extends OpenOption> options) { int opt = 0; for (OpenOption o : options) { if (!optionMap.containsKey(o)) { throw new UnsupportedOperationException("Option " + o + " is not supported at this time"); } opt |= optionMap.get(o); } return opt; }  @Override int read(ByteBuffer byteBuffer); @Override long read(ByteBuffer[] byteBuffers, int offset, int length); @Override int write(ByteBuffer byteBuffer); @Override long write(ByteBuffer[] byteBuffers, int offset, int length); @Override long position(); @Override FileChannel position(long offset); @Override long size(); @Override FileChannel truncate(long l); @Override void force(boolean b); @Override long transferTo(long l, long l2, WritableByteChannel writableByteChannel); @Override long transferFrom(ReadableByteChannel readableByteChannel, long l, long l2); @Override int read(ByteBuffer byteBuffer, long position); @Override int write(ByteBuffer byteBuffer, long position); @Override MappedByteBuffer map(MapMode mapMode, long l, long l2); @Override FileLock lock(long l, long l2, boolean b); @Override FileLock tryLock(long l, long l2, boolean b); static final Map<StandardOpenOption, Integer> optionMap; static final Map<PosixFilePermission, Integer> perms; }### Answer:
@Test public void testParseOptions() { Set<StandardOpenOption> options = new HashSet<StandardOpenOption>(); options.add(StandardOpenOption.APPEND); options.add(StandardOpenOption.WRITE); int result = channel.parseOptions(options); assertEquals(GlusterOpenOption.O_RDWR | GlusterOpenOption.O_APPEND, result); }