@Test
public void testWithFile() throws Exception {

  final File f1 = new File(this.getClass().getResource("/dublincore.xml").toURI());
  final Option<String> r1 = withFile(f1, new Function2.X<InputStream, File, String>() {
    @Override
    public String xapply(InputStream in, File file) throws IOException {
      return IOUtils.readLines(in).get(0);
    }
  });
  assertEquals(some("<?xml version=\"1.0\"?>"), r1);
  final File f2 = new File("i-do-not-exist");
  final Option<String> r2 = withFile(f2, new Function2.X<InputStream, File, String>() {
    @Override
    public String xapply(InputStream in, File file) throws IOException {
      return IOUtils.readLines(in).get(0);
    }
  });
  assertEquals(none(String.class), r2);
}