@Test
public void testClientSideException() throws IOException {

  Configuration conf = new HdfsConfiguration();
  MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
    .numDataNodes(0).build();
  NNStorage mockStorage = Mockito.mock(NNStorage.class);
  List<File> localPath = Collections.singletonList(
      new File("/xxxxx-does-not-exist/blah"));
     
  try {
    URL fsName = DFSUtil.getInfoServer(
        cluster.getNameNode().getServiceRpcAddress(), conf,
        DFSUtil.getHttpClientScheme(conf)).toURL();
    String id = "getimage=1&txid=0";
    TransferFsImage.getFileClient(fsName, id, localPath, mockStorage, false);      
    fail("Didn't get an exception!");
  } catch (IOException ioe) {
    Mockito.verify(mockStorage).reportErrorOnFile(localPath.get(0));
    assertTrue(
        "Unexpected exception: " + StringUtils.stringifyException(ioe),
        ioe.getMessage().contains("Unable to download to any storage"));
  } finally {
    cluster.shutdown();      
  }
}