@Test public void write_withEmptyBuffer_andSingleByte_doesNotWriteToStream() throws IOException { os.write(next()); assertThat(inner.toByteArray()).isEmpty(); }
@Test public void write_withEmptyBuffer_andDataWithOffsetSizeSmallerThanBuffer_doesNotWriteToStream() throws IOException { int offset = 1; int length = bufferSize - offset; byte[] data = nextWithOffset(offset, length); os.write(data, offset, length); assertThat(inner.toByteArray()).isEmpty(); }
@Test public void write_withEmptyBuffer_andDataSmallerThanBuffer_doesNotWriteToStream() throws IOException { os.write(next(bufferSize - 1)); assertThat(inner.toByteArray()).isEmpty(); }
@Test public void write_withEmptyBuffer_andDataWithPaddingSizeSmallerThanBuffer_doesNotWriteToStream() throws IOException { int padding = 1; int length = bufferSize - padding; byte[] data = nextWithPadding(length, padding); os.write(data, 0, length); assertThat(inner.toByteArray()).isEmpty(); }
@Test public void write_withDataInBuffer_bufferLessThanRemaining_doesNotWriteToStream() throws IOException { os.write(next()); os.write(next(remaining() - 1)); assertThat(inner.toByteArray()).isEmpty(); }
@Test @SuppressWarnings("deprecation") public void toByteArray_TaggingDisabled() throws TagContextSerializationException { tagsComponent.setState(TaggingState.DISABLED); assertThat(serializer.toByteArray(tagContext)).isEmpty(); }
@Test @SuppressWarnings("deprecation") public void toByteArray_TaggingReenabled() throws TagContextSerializationException { final byte[] serialized = serializer.toByteArray(tagContext); tagsComponent.setState(TaggingState.DISABLED); assertThat(serializer.toByteArray(tagContext)).isEmpty(); tagsComponent.setState(TaggingState.ENABLED); assertThat(serializer.toByteArray(tagContext)).isEqualTo(serialized); }