### Question:
DeferredFileBody implements RawDataBody, SizeAware { public File getFile() throws IOException { if (file == null) { writeMemoryToFile(); } return file; } DeferredFileBody(FileFactory fileFactory, String transferEncoding); @VisibleForTesting  DeferredFileBody(int memoryBackedThreshold, FileFactory fileFactory,
            String transferEncoding); OutputStream getOutputStream(); @Override InputStream getInputStream(); @Override long getSize(); File getFile(); @Override void setEncoding(String encoding); @Override void writeTo(OutputStream out); @Override String getEncoding(); static final int DEFAULT_MEMORY_BACKED_THRESHOLD; }### Answer:
@Test public void withShortData__getFile__shouldWriteDataToFile() throws Exception { writeShortTestData(); File returnedFile = deferredFileBody.getFile(); InputStream fileInputStream = new FileInputStream(returnedFile); byte[] dataFromFile = IOUtils.toByteArray(fileInputStream); assertSame(createdFile, returnedFile); assertArrayEquals(TEST_DATA_SHORT, dataFromFile); }
@Test public void withLongData__getFile__shouldReturnCreatedFile() throws Exception { writeLongTestData(); File returnedFile = deferredFileBody.getFile(); assertSame(createdFile, returnedFile); }