@Test
public void testNativeIO() throws IOException {

  FrameworkUploader uploader = new FrameworkUploader();
  File parent = new File(testDir);
  try {
    // Create a parent directory
    parent.deleteOnExit();
    Assert.assertTrue(parent.mkdirs());
    // Create a target file
    File targetFile = new File(parent, "a.txt");
    try(FileOutputStream os = new FileOutputStream(targetFile)) {
      IOUtils.writeLines(Lists.newArrayList("a", "b"), null, os);
    }
    Assert.assertFalse(uploader.checkSymlink(targetFile));
    // Create a symlink to the target
    File symlinkToTarget = new File(parent, "symlinkToTarget.txt");
    try {
      Files.createSymbolicLink(
          Paths.get(symlinkToTarget.getAbsolutePath()),
          Paths.get(targetFile.getAbsolutePath()));
    } catch (UnsupportedOperationException e) {
      // Symlinks are not supported, so ignore the test
      Assume.assumeTrue(false);
    }
    Assert.assertTrue(uploader.checkSymlink(symlinkToTarget));
    // Create a symlink to the target with /./ in the path
    symlinkToTarget = new File(parent.getAbsolutePath() +
          "/./symlinkToTarget2.txt");
    try {
      Files.createSymbolicLink(
          Paths.get(symlinkToTarget.getAbsolutePath()),
          Paths.get(targetFile.getAbsolutePath()));
    } catch (UnsupportedOperationException e) {
      // Symlinks are not supported, so ignore the test
      Assume.assumeTrue(false);
    }
    Assert.assertTrue(uploader.checkSymlink(symlinkToTarget));
    // Create a symlink outside the current directory
    File symlinkOutside = new File(parent, "symlinkToParent.txt");
    try {
      Files.createSymbolicLink(
          Paths.get(symlinkOutside.getAbsolutePath()),
          Paths.get(parent.getAbsolutePath()));
    } catch (UnsupportedOperationException e) {
      // Symlinks are not supported, so ignore the test
      Assume.assumeTrue(false);
    }
    Assert.assertFalse(uploader.checkSymlink(symlinkOutside));
  } finally {
    FileUtils.deleteDirectory(parent);
  }
}