### Question:
BooleanOutputStream implements ValueOutputStream<BooleanStreamCheckpoint> { public void writeBoolean(boolean value) { checkState(!closed); if (value) { data |= 0x1 << (7 - bitsInData); } bitsInData++; if (bitsInData == 8) { flushData(); } } BooleanOutputStream(CompressionKind compression, int bufferSize);  BooleanOutputStream(OrcOutputBuffer buffer); private  BooleanOutputStream(ByteOutputStream byteOutputStream); void writeBoolean(boolean value); void writeBooleans(int count, boolean value); @Override void recordCheckpoint(); @Override void close(); @Override List<BooleanStreamCheckpoint> getCheckpoints(); @Override StreamDataOutput getStreamDataOutput(OrcColumnId columnId); @Override long getBufferedBytes(); @Override long getRetainedBytes(); @Override void reset();  }### Answer:
@Test public void testWriteBoolean() { List<List<Integer>> testGroups = ImmutableList.of( ImmutableList.of(149, 317, 2), ImmutableList.of(2), ImmutableList.of(1, 2, 4, 0, 8), ImmutableList.of(1, 4, 8, 1024, 10000), ImmutableList.of(14000, 1, 2)); for (List<Integer> counts : testGroups) { OrcOutputBuffer buffer = new OrcOutputBuffer(NONE, 1024); BooleanOutputStream output = new BooleanOutputStream(buffer); for (int count : counts) { output.writeBooleans(count, true); output.recordCheckpoint(); } output.close(); List<BooleanStreamCheckpoint> batchWriteCheckpoints = output.getCheckpoints(); DynamicSliceOutput slice = new DynamicSliceOutput(128); buffer.writeDataTo(slice); Slice batchWriteBuffer = slice.slice(); buffer.reset(); output.reset(); for (int count : counts) { for (int i = 0; i < count; i++) { output.writeBoolean(true); } output.recordCheckpoint(); } output.close(); List<BooleanStreamCheckpoint> singleWriteCheckpoints = output.getCheckpoints(); slice = new DynamicSliceOutput(128); buffer.writeDataTo(slice); Slice singleWriteBuffer = slice.slice(); assertEquals(batchWriteCheckpoints.size(), singleWriteCheckpoints.size()); for (int i = 0; i < batchWriteCheckpoints.size(); i++) { assertTrue(checkpointsEqual(batchWriteCheckpoints.get(i), singleWriteCheckpoints.get(i))); } assertEquals(batchWriteBuffer, singleWriteBuffer); } }