コード例 #1
0
 @Test
 public void closeCanBeCalledMultipleTimes() throws Exception {
   File dir = new File("src/test/files/bytecode/bin/");
   FileSystemLoader loader = new FileSystemLoader(dir);
   loader.close();
   loader.close();
 }
コード例 #2
0
  @Test
  public void testLoadBytes() throws Exception {
    File dir = new File("src/test/files/bytecode/bin/");
    FileSystemLoader loader = new FileSystemLoader(dir);

    assertThat(loader.loadBytes("notfound")).isEmpty();

    assertThat(loader.loadBytes("tags/TagName.class")).isNotEmpty();

    loader.close();

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Loader closed");
    loader.loadBytes("tags/TagName.class");
  }
コード例 #3
0
  @Test
  public void testFindResource() throws Exception {
    File dir = new File("src/test/files/bytecode/bin/");
    FileSystemLoader loader = new FileSystemLoader(dir);

    assertThat(loader.findResource("notfound")).isNull();
    assertThat(loader.findResource("tags"))
        .as("existing directories should not be used - only files")
        .isNull();

    URL url = loader.findResource("tags/TagName.class");
    assertThat(url).isNotNull();
    assertThat(url.toString()).startsWith("file:");
    assertThat(url.toString()).endsWith("TagName.class");

    loader.close();

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Loader closed");
    loader.findResource("tags/TagName.class");
  }