Ejemplo n.º 1
0
  @Test
  public void shouldCopyFileFromJar() throws IOException {
    // given
    File folder = temporaryFolder.newFolder();
    File file = new File(folder, "some/folders/config.yml");

    // when
    boolean result = FileUtils.copyFileFromResource(file, "config.yml");

    // then
    assertThat(result, equalTo(true));
    assertThat(file.exists(), equalTo(true));
    File configJarFile = TestHelper.getJarFile("/config.yml");
    assertThat(file.length(), equalTo(configJarFile.length()));
  }
Ejemplo n.º 2
0
  @Test
  public void shouldNotCopyFile() throws IOException {
    // given
    File folder = temporaryFolder.newFolder();
    File file = new File(folder, "config.yml");
    // purposely don't copy config.yml to verify that config.yml isn't copied by the method
    File emailJarFile = TestHelper.getJarFile("/email.html");
    Files.copy(emailJarFile, file);

    // when
    boolean result = FileUtils.copyFileFromResource(file, "config.yml");

    // then
    assertThat(result, equalTo(true));
    assertThat(file.length(), equalTo(emailJarFile.length()));
  }