### Question:
ResponderImpl implements Responder { @Override public void sendResponseFile(String contentType, InputStream file) { Preconditions.checkNotNull(contentType); Preconditions.checkNotNull(file); logger.debug("response: send file"); try { byte[] b = FileUtils.streamBytes(file, false); resp.setContentType(contentType); resp.setContentLength(b.length); ServletOutputStream out = resp.getOutputStream(); out.write(b); out.flush(); out.close(); resp.setStatus(HttpServletResponse.SC_OK); } catch (IOException e) { logger.error(e.getMessage(), e); } } ResponderImpl(String contentType, HttpServletResponse resp, IntEncoder intEncoder, WBXMLTools wbxmlTools, 
			DOMDumper domDumper); @Override void sendWBXMLResponse(String defaultNamespace, Document doc); @Override void sendXMLResponse(String defaultNamespace, Document doc); @Override void sendResponseFile(String contentType, InputStream file); void sendMSSyncMultipartResponse(String defaultNamespace,
			Document doc, Collection<byte[]> files, boolean gzip); @Override void sendError(int statusCode); @Override void sendNoChangeResponse();  }### Answer:
@Test public void sendResponseFileWithData() throws IOException { String contentType = "application/pdf"; byte[] data = {1, 2, 3, 4, 5}; sendResponseFile(contentType, data); }
@Test public void sendResponseFileWithEmptyStream() throws IOException { String contentType = "application/pdf"; byte[] data = {}; sendResponseFile(contentType, data); }
@Test(expected=NullPointerException.class) public void sendResponseFileWithNullContentType() { String contentType = null; byte[] data = {1, 2, 3, 4, 5}; HttpServletResponse servletResponse = EasyMock.createMock(HttpServletResponse.class); IntEncoder intEncoder = EasyMock.createMock(IntEncoder.class); WBXMLTools wbxmlTools = EasyMock.createMock(WBXMLTools.class); DOMDumper domDumper = EasyMock.createMock(DOMDumper.class); EasyMock.replay(servletResponse, intEncoder, wbxmlTools); ResponderImpl responder = new ResponderImpl("unused content type", servletResponse, intEncoder, wbxmlTools, domDumper); try { responder.sendResponseFile(contentType, new ByteArrayInputStream(data)); } catch (NullPointerException t) { EasyMock.verify(servletResponse, intEncoder, wbxmlTools); throw t; } }
@Test(expected=NullPointerException.class) public void sendResponseFileWithNullStream() { String contentType = "application/pdf"; HttpServletResponse servletResponse = EasyMock.createMock(HttpServletResponse.class); IntEncoder intEncoder = EasyMock.createMock(IntEncoder.class); WBXMLTools wbxmlTools = EasyMock.createMock(WBXMLTools.class); DOMDumper domDumper = EasyMock.createMock(DOMDumper.class); EasyMock.replay(servletResponse, intEncoder, wbxmlTools); ResponderImpl responder = new ResponderImpl("unused content type", servletResponse, intEncoder, wbxmlTools, domDumper); try { responder.sendResponseFile(contentType, null); } catch (NullPointerException t) { EasyMock.verify(servletResponse, intEncoder, wbxmlTools); throw t; } }