@Test
public void testShrinkStatus() throws IOException {

  Configuration conf = getConfiguration();
  MockFileSystem mockFs =
          (MockFileSystem) new Path("test:///").getFileSystem(conf);
  Path dir1  = new Path("test:/a1");
  RemoteIterator<LocatedFileStatus> statuses = mockFs.listLocatedStatus(dir1);
  boolean verified = false;
  while (statuses.hasNext()) {
    LocatedFileStatus orig = statuses.next();
    LocatedFileStatus shrink =
        (LocatedFileStatus)FileInputFormat.shrinkStatus(orig);
    Assert.assertTrue(orig.equals(shrink));
    if (shrink.getBlockLocations() != null) {
      Assert.assertEquals(orig.getBlockLocations().length,
          shrink.getBlockLocations().length);
      for (int i = 0; i < shrink.getBlockLocations().length; i++) {
        verified = true;
        BlockLocation location = shrink.getBlockLocations()[i];
        BlockLocation actual = orig.getBlockLocations()[i];
        Assert.assertNotNull(((HdfsBlockLocation)actual).getLocatedBlock());
        Assert.assertEquals(BlockLocation.class.getName(),
            location.getClass().getName());
        Assert.assertArrayEquals(actual.getHosts(), location.getHosts());
        Assert.assertArrayEquals(actual.getCachedHosts(),
            location.getCachedHosts());
        Assert.assertArrayEquals(actual.getStorageIds(),
            location.getStorageIds());
        Assert.assertArrayEquals(actual.getStorageTypes(),
            location.getStorageTypes());
        Assert.assertArrayEquals(actual.getTopologyPaths(),
            location.getTopologyPaths());
        Assert.assertArrayEquals(actual.getNames(), location.getNames());
        Assert.assertEquals(actual.getLength(), location.getLength());
        Assert.assertEquals(actual.getOffset(), location.getOffset());
        Assert.assertEquals(actual.isCorrupt(), location.isCorrupt());
      }
    } else {
      Assert.assertTrue(orig.getBlockLocations() == null);
    }
  }
  Assert.assertTrue(verified);
}