use of org.cactoos.bytes.BytesOf in project cactoos by yegor256.
the class TailOfTest method failsIfBufferSizeSmallerThanTailSize.
@Test(expected = IllegalArgumentException.class)
public void failsIfBufferSizeSmallerThanTailSize() throws Exception {
final int size = 4;
new BytesOf(new TailOf(new InputOf(new BytesOf(this.generate(size))), size, size - 1)).asBytes();
}
use of org.cactoos.bytes.BytesOf in project cactoos by yegor256.
the class TailOfTest method tailsOnLongStream.
@Test
public void tailsOnLongStream() throws Exception {
final int size = 4;
final byte[] bytes = this.generate(size);
new Assertion<>("Can't tail long stream", new BytesOf(new TailOf(new InputOf(new BytesOf(bytes)), size - 1)).asBytes(), new IsEqual<>(Arrays.copyOfRange(bytes, 1, bytes.length))).affirm();
}
use of org.cactoos.bytes.BytesOf in project cactoos by yegor256.
the class TailOfTest method tailsOnShorterStream.
@Test
public void tailsOnShorterStream() throws Exception {
final int size = 4;
final byte[] bytes = this.generate(size);
new Assertion<>("Can't tail shorter stream", new BytesOf(new TailOf(new InputOf(new BytesOf(bytes)), size + 1)).asBytes(), new IsEqual<>(bytes)).affirm();
}
use of org.cactoos.bytes.BytesOf in project cactoos by yegor256.
the class TailOfTest method tailsOnExactStream.
@Test
public void tailsOnExactStream() throws Exception {
final int size = 4;
final byte[] bytes = this.generate(size);
new Assertion<>("Can't tail exact stream", new BytesOf(new TailOf(new InputOf(new BytesOf(bytes)), size)).asBytes(), new IsEqual<>(bytes)).affirm();
}
use of org.cactoos.bytes.BytesOf in project cactoos by yegor256.
the class TailOfTest method tailsOnStreamLongerThanBufferAndBytes.
@Test
public void tailsOnStreamLongerThanBufferAndBytes() throws Exception {
final int size = 4;
final byte[] bytes = this.generate(size);
new Assertion<>("Can't tail longer stream", new BytesOf(new TailOf(new InputOf(new BytesOf(bytes)), size - 1, size - 1)).asBytes(), new IsEqual<>(Arrays.copyOfRange(bytes, 1, bytes.length))).affirm();
}
Aggregations