use of org.cactoos.text.Randomized in project cactoos by yegor256.
the class AppendToTest method failsIfFileDoesNotExist.
/**
* Ensures that AppendTo is failing on a negative predicate result.
*/
@Test
public void failsIfFileDoesNotExist() throws Exception {
final File source = new File(new Randomized('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h').asString());
new Assertion<>("Can't throw exception with proper message", () -> new AppendTo(source).stream(), new Throws<>(source.getPath(), NoSuchFileException.class)).affirm();
}
use of org.cactoos.text.Randomized in project cactoos by yegor256.
the class ImmutableTest method decoratesToString.
@Test
public void decoratesToString() throws Exception {
final String string = new Randomized().asString();
final Iterator<Object> iterator = new Iterator<Object>() {
public Object next() {
return new Object();
}
public boolean hasNext() {
return false;
}
public String toString() {
return string;
}
};
final Iterator<Object> immutable = new Immutable<>(iterator);
new Assertion<>("must delegate toString to decorated iterator", new TextOf(immutable.toString()), new IsText(iterator.toString())).affirm();
}