use of org.cactoos.text.Concatenated in project cactoos by yegor256.
the class BytesOfTest method readsLargeInMemoryContent.
@Test
void readsLargeInMemoryContent() throws Exception {
final int multiplier = 5_000;
final String body = "1234567890";
new Assertion<>("must read large content from in-memory Input", new BytesOf(new InputOf(new Concatenated(new HeadOf<>(multiplier, new Endless<>(new TextOf(body)))))).asBytes().length, new IsEqual<>(body.length() * multiplier)).affirm();
}
use of org.cactoos.text.Concatenated in project cactoos by yegor256.
the class AppendToTest method appendsUnicodeToFile.
/**
* Ensures that AppendTo is appending unicode text to a given file.
* @throws Exception if fails
*/
@Test
public void appendsUnicodeToFile() throws Exception {
final File source = this.folder.newFile();
final String first = "Hello, товарищ output #3 äÄ ";
new OutputTo(source).stream().write(first.getBytes(StandardCharsets.UTF_8));
final String second = "#4 äÄ üÜ öÖ and ß";
new AppendTo(source).stream().write(second.getBytes(StandardCharsets.UTF_8));
new Assertion<>("Can't find expected unicode text content", new InputOf(source), new HasContent(new Concatenated(first, second))).affirm();
}
use of org.cactoos.text.Concatenated in project cactoos by yegor256.
the class AppendToTest method appendsToFile.
/**
* Ensures that AppendTo is appending to a given file.
* @throws Exception if fails
*/
@Test
public void appendsToFile() throws Exception {
final File source = this.folder.newFile();
final String first = "abdcd";
new OutputTo(source).stream().write(first.getBytes());
final String second = "efgh";
new AppendTo(source).stream().write(second.getBytes());
new Assertion<>("Does not contain expected text", new InputOf(source), new HasContent(new Concatenated(first, second))).affirm();
}
Aggregations