use of org.hamcrest.core.IsNot in project cactoos by yegor256.
the class NoNullsTest method addsToEmptyCollection.
@Test
void addsToEmptyCollection() {
final Collection<Integer> col = new NoNulls<>(new ListOf<>());
col.add(1);
new Assertion<>("Must not be empty after an item was added", col.isEmpty(), new IsNot<>(new IsTrue())).affirm();
}
use of org.hamcrest.core.IsNot in project cactoos by yegor256.
the class ComparableTextTest method equalsOfDifferentText.
@Test
public void equalsOfDifferentText() {
final Text text = new ComparableText(new TextOf("my value"));
new Assertion<>("Is equal to the completely different object", text, new IsNot<>(new IsEqual<>("The string is ignored"))).affirm();
new Assertion<>("Is equal to the completely different text", text, new IsNot<>(new IsText("The text is ignored"))).affirm();
new Assertion<>("Is equal to the different ComparableText", text, new IsNot<>(new IsEqual<>(new ComparableText(new TextOf("A different text"))))).affirm();
new Assertion<>("The string is equal to the different ComparableText", text, new IsNot<>(new IsText(new ComparableText(new TextOf("A different value"))))).affirm();
}
use of org.hamcrest.core.IsNot in project cactoos by yegor256.
the class NoNullsTest method retainsAll.
@Test
void retainsAll() {
final Collection<Integer> col = new NoNulls<>(new ListOf<>(1, 2, 3));
new Assertion<>("NoNulls#retainAll(...) must return false for the same elements", col.retainAll(new ListOf<>(1, 2, 3)), new IsNot<>(new IsTrue())).affirm();
}
use of org.hamcrest.core.IsNot in project cactoos by yegor256.
the class TempFolderTest method deletesNonEmptyDirectory.
@Test
void deletesNonEmptyDirectory() throws Exception {
final TempFolder temp = new TempFolder();
final Path root = temp.value();
new ForEach<>(new ProcOf<String>(name -> {
final Path dir = Files.createDirectories(new File(root.toFile(), name).toPath());
new ForEach<>(new ProcOf<String>(filename -> {
new TempFile(() -> dir, filename, "").value();
})).exec(new IterableOf<>("file1.txt", "file2.txt", "file3.txt"));
})).exec(new IterableOf<>("a", "b", "c", "d", "e"));
temp.close();
new Assertion<>("Can't delete not empty folder while closing", temp.value().toFile().exists(), new IsNot<>(new IsTrue())).affirm();
}
use of org.hamcrest.core.IsNot in project cactoos by yegor256.
the class WriterAsOutputStreamTest method writesToFileAndRemovesIt.
@Test
public void writesToFileAndRemovesIt() throws Exception {
final Path temp = this.folder.newFile().toPath();
final String content = "Hello, товарищ! How are you?";
try (OutputStreamWriter writer = new OutputStreamWriter(Files.newOutputStream(temp.toAbsolutePath()), StandardCharsets.UTF_8)) {
new LengthOf(new TeeInput(new InputOf(content), new OutputTo(new WriterAsOutputStream(writer, StandardCharsets.UTF_8, // @checkstyle MagicNumber (1 line)
345)))).value();
}
Files.delete(temp);
new Assertion<>("file must not exist anymore", Files.exists(temp), new IsNot<>(new IsTrue())).affirm();
}
Aggregations