@Test public void ordered() { Set<String> list = Resources.list(); Set<String> ordered = new TreeSet<>(list); assertThat(list).isEqualTo(ordered); }
@Test @SuppressWarnings("unchecked") public void parse_object() throws IOException { List<Object> members = (List<Object>) parser.parse(resources.sourceFile(Paths.get("_data", "members.yml"))); assertThat(members).hasSize(3); assertThat((Map<String, Object>) members.get(0)) .containsExactly(entry("name", "Tom Preston-Werner"), entry("github", "mojombo")); }
@Test public void extension() { assertThat(Resources.extension(Paths.get("file.txt"))).isEqualTo(".txt"); assertThat(Resources.extension(Paths.get("file.css.map"))).isEqualTo(".map"); assertThat(Resources.extension(Paths.get(".dotfile.ext"))).isEqualTo(".ext"); assertThat(Resources.extension(Paths.get("file"))).isEmpty(); assertThat(Resources.extension(Paths.get(".dotfile"))).isEmpty(); assertThat(Resources.extension(Paths.get("."))).isEmpty(); }
@Test public void list() { assertThat(Resources.list()).contains("js/script.coffee", "test.html").doesNotContain(""); }
@Test public void exists() { assertThat(Resources.exists(Paths.get("index.html"))).isTrue(); assertThat(Resources.exists(Paths.get("js"))).isFalse(); }