use of org.llorllale.cactoos.matchers.HasSize in project cactoos by yegor256.
the class ListOfTest method makesListFromMappedIterable.
@Test
public void makesListFromMappedIterable() throws Exception {
final List<Integer> list = new ListOf<>(new Mapped<Integer>(i -> i + 1, new IterableOf<>(1, -1, 0, 1)));
MatcherAssert.assertThat("Can't turn a mapped iterable into a list", list, new HasSize(4));
MatcherAssert.assertThat("Can't turn a mapped iterable into a list, again", list, new HasSize(4));
}
use of org.llorllale.cactoos.matchers.HasSize in project cactoos by yegor256.
the class DirectoryTest method listsFilesInDirectoryByFile.
@Test
public void listsFilesInDirectoryByFile() throws Exception {
final File file = this.folder.newFolder();
final Path dir = file.toPath();
dir.resolve("parent/child").toFile().mkdirs();
Files.write(dir.resolve("parent/child/file"), "".getBytes());
new Assertion<>("must list files in a directory represented by a file", new Directory(file), // @checkstyle MagicNumber (1 line)
new HasSize(4)).affirm();
}
use of org.llorllale.cactoos.matchers.HasSize in project cactoos by yegor256.
the class DirectoryTest method listsFilesAndFoldersInDirectory.
@Test
public void listsFilesAndFoldersInDirectory() throws IOException {
final Path dir = this.folder.newFolder().toPath();
dir.resolve("x/y").toFile().mkdirs();
Files.write(dir.resolve("x/y/test"), "".getBytes());
new Assertion<>("must list files in a directory represented by a path", new Directory(dir), // @checkstyle MagicNumber (1 line)
new HasSize(4)).affirm();
}
use of org.llorllale.cactoos.matchers.HasSize in project cactoos by yegor256.
the class ListOfTest method sizeTest.
@Test
public void sizeTest() throws Exception {
final int size = 42;
MatcherAssert.assertThat("Can't build a list with a certain size", new ListOf<>(Collections.nCopies(size, 0)), new HasSize(size));
}
Aggregations