@Test
public void testPut() {

  Path path = new Path("/path");
  PathMetadata pathMeta1 = new PathMetadata(
      new S3AFileStatus(true, new Path(path, "dir1"), TEST_OWNER));
  PathMetadata pathMeta2 = new PathMetadata(
      new S3AFileStatus(true, new Path(path, "dir2"), TEST_OWNER));
  PathMetadata pathMeta3 = new PathMetadata(
      new S3AFileStatus(123, 456, new Path(path, "file1"), 8192, TEST_OWNER,
          TEST_ETAG, TEST_VERSION_ID));
  List<PathMetadata> listing = Arrays.asList(pathMeta1, pathMeta2, pathMeta3);
  DirListingMetadata meta = new DirListingMetadata(path, listing, false);
  assertEquals(path, meta.getPath());
  assertNotNull(meta.getListing());
  assertFalse(meta.getListing().isEmpty());
  assertTrue(meta.getListing().contains(pathMeta1));
  assertTrue(meta.getListing().contains(pathMeta2));
  assertTrue(meta.getListing().contains(pathMeta3));
  assertFalse(meta.isAuthoritative());
  PathMetadata pathMeta4 = new PathMetadata(
      new S3AFileStatus(true, new Path(path, "dir3"), TEST_OWNER));
  meta.put(pathMeta4);
  assertTrue(meta.getListing().contains(pathMeta4));
  assertEquals(pathMeta4, meta.get(pathMeta4.getFileStatus().getPath()));
}