コード例 #1
0
  @Test
  public void ordered() {
    Set<String> list = Resources.list();
    Set<String> ordered = new TreeSet<>(list);

    assertThat(list).isEqualTo(ordered);
  }
コード例 #2
0
  @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"));
  }
コード例 #3
0
  @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();
  }
コード例 #4
0
 @Test
 public void list() {
   assertThat(Resources.list()).contains("js/script.coffee", "test.html").doesNotContain("");
 }
コード例 #5
0
 @Test
 public void exists() {
   assertThat(Resources.exists(Paths.get("index.html"))).isTrue();
   assertThat(Resources.exists(Paths.get("js"))).isFalse();
 }