public static FileSystem write(final FileSystem fs, final Path path,
      final byte[] bytes) throws IOException {

    Objects.requireNonNull(path);
    Objects.requireNonNull(bytes);

    try (FSDataOutputStream out = fs.createFile(path).overwrite(true).build()) {
      out.write(bytes);
    }

    return fs;
  }
@Test
  public void testWriteStringsFileContext() throws IOException {
    URI uri = tmp.toURI();
    Configuration conf = new Configuration();
    FileContext fc = FileContext.getFileContext(uri, conf);
    Path testPath = new Path(new Path(uri), "writestrings.out");

    Collection<String> write = Arrays.asList("over", "the", "lazy", "dog");

    FileUtil.write(fc, testPath, write, StandardCharsets.UTF_8);

    List<String> read =
        FileUtils.readLines(new File(testPath.toUri()), StandardCharsets.UTF_8);

    assertEquals(write, read);
  }