@Test
public void testDoGetShouldWriteTheFileContentIntoServletOutputStream()
    throws Exception {

  MiniDFSCluster cluster = new MiniDFSCluster(CONF, 1, true, null);
  try {
    Path testFile = createFile();
    setUpForDoGetTest(cluster, testFile);
    ServletOutputStreamExtn outStream = new ServletOutputStreamExtn();
    Mockito.doReturn(outStream).when(mockHttpServletResponse)
        .getOutputStream();
    StreamFile sfile = new StreamFile() {
      private static final long serialVersionUID = 7715590481809562722L;
      public ServletContext getServletContext() {
        return mockServletContext;
      }
    };
    StreamFile.nameNodeAddr = NameNode.getServiceAddress(CONF, true);
    sfile.doGet(mockHttpServletRequest, mockHttpServletResponse);
    assertEquals("Not writing the file data into ServletOutputStream",
        outStream.getResult(), "test");
  } finally {
    cluster.shutdown();
  }
}