### Question:
HTTPRequest { public final byte[] setDataFromFile(String filename) throws IOException { final File file = new File(filename); final ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream((int)file.length()); new StreamCopier(4096, true).copy( new FileInputStream(file), byteArrayStream); final byte[] defaultData = byteArrayStream.toByteArray(); m_defaultData = defaultData; return defaultData; } HTTPRequest(); final String getUrl(); final void setUrl(String url); final NVPair[] getHeaders(); final void setHeaders(NVPair[] headers); String toString(); final byte[] getData(); final void setData(byte[] data); final byte[] setDataFromFile(String filename); final NVPair[] getFormData(); final void setFormData(NVPair[] formData); boolean getReadResponseBody(); void setReadResponseBody(boolean b); final HTTPResponse DELETE(); final HTTPResponse DELETE(String uri); final HTTPResponse DELETE(final String uri, NVPair[] headers); final HTTPResponse GET(); final HTTPResponse GET(String uri); final HTTPResponse GET(NVPair[] queryData); final HTTPResponse GET(final String uri, final NVPair[] queryData); final HTTPResponse GET(final String uri,
                                final NVPair[] queryData,
                                NVPair[] headers); final HTTPResponse HEAD(); final HTTPResponse HEAD(String uri); final HTTPResponse HEAD(NVPair[] queryData); final HTTPResponse HEAD(final String uri, final NVPair[] queryData); final HTTPResponse HEAD(final String uri,
                                 final NVPair[] queryData,
                                 NVPair[] headers); final HTTPResponse OPTIONS(); final HTTPResponse OPTIONS(String uri); final HTTPResponse OPTIONS(final String uri, final byte[] data); final HTTPResponse OPTIONS(final String uri,
                                    final byte[] data,
                                    NVPair[] headers); final HTTPResponse OPTIONS(String uri, InputStream inputStream); final HTTPResponse OPTIONS(final String uri,
                                    final InputStream inputStream,
                                    NVPair[] headers); final HTTPResponse POST(); final HTTPResponse POST(String uri); final HTTPResponse POST(NVPair[] formData); final HTTPResponse POST(String uri, NVPair[] formData); final HTTPResponse POST(final String uri,
                                 final NVPair[] formData,
                                 NVPair[] headers); final HTTPResponse POST(final String uri,
                                 final NVPair[] formData,
                                 NVPair[] headers,
                                 boolean isMultipart); final HTTPResponse POST(String uri, byte[] data); final HTTPResponse POST(final String uri,
                                 final byte[] data,
                                 NVPair[] headers); final HTTPResponse POST(String uri, InputStream inputStream); final HTTPResponse POST(final String uri,
                                 final InputStream inputStream,
                                 NVPair[] headers); final HTTPResponse PUT(); final HTTPResponse PUT(String uri); final HTTPResponse PUT(String uri, byte[] data); final HTTPResponse PUT(final String uri,
                                final byte[] data,
                                NVPair[] headers); final HTTPResponse PUT(String uri, InputStream inputStream); final HTTPResponse PUT(final String uri,
                                final InputStream inputStream,
                                NVPair[] headers); final HTTPResponse PATCH(); final HTTPResponse PATCH(String uri); final HTTPResponse PATCH(String uri, byte[] data); final HTTPResponse PATCH(final String uri,
                                final byte[] data,
                                NVPair[] headers); final HTTPResponse PATCH(String uri, InputStream inputStream); final HTTPResponse PATCH(final String uri,
                                final InputStream inputStream,
                                NVPair[] headers); final HTTPResponse TRACE(); final HTTPResponse TRACE(String uri); final HTTPResponse TRACE(final String uri, NVPair[] headers); static Test.InstrumentationFilter getHttpMethodFilter();  }### Answer:
@Test public void testSetDataFromFile() throws Exception { final File file = File.createTempFile("testing", "123"); file.deleteOnExit(); final OutputStream out = new FileOutputStream(file); final byte[] data5 = randomBytes(10); out.write(data5); out.close(); final HTTPRequest request = new HTTPRequest(); request.setDataFromFile(file.getPath()); assertArraysEqual(data5, request.getData()); }