@Test public void shouldUseOutputStreamWhenWrite() throws IOException { OutputStream out = mock(OutputStream.class); Part part = new TestPart(name); part.write(out); verify(out, atLeastOnce()).write(Matchers.any(byte[].class)); }
@Override public void write(OutputStream out) throws IOException { writeContentDisposition(out); writeName(out); writeExtraHeaderIfNotNull(out); writeCRLF(out); writeContentTypeIfNotNull(out); writeCRLF(out); writeContent(out); writeCRLF(out); }
AbstractPart implements Part { @Override public void write(OutputStream out) throws IOException { writeContentDisposition(out); writeName(out); writeExtraHeaderIfNotNull(out); writeCRLF(out); writeContentTypeIfNotNull(out); writeCRLF(out); writeContent(out); writeCRLF(out); } }
AbstractPart implements Part { @Override public void write(OutputStream out) throws IOException { writeContentDisposition(out); writeName(out); writeExtraHeaderIfNotNull(out); writeCRLF(out); writeContentTypeIfNotNull(out); writeCRLF(out); writeContent(out); writeCRLF(out); } AbstractPart(String name); }
AbstractPart implements Part { @Override public void write(OutputStream out) throws IOException { writeContentDisposition(out); writeName(out); writeExtraHeaderIfNotNull(out); writeCRLF(out); writeContentTypeIfNotNull(out); writeCRLF(out); writeContent(out); writeCRLF(out); } AbstractPart(String name); @Override void write(OutputStream out); @Override String getName(); }
AbstractPart implements Part { @Override public void write(OutputStream out) throws IOException { writeContentDisposition(out); writeName(out); writeExtraHeaderIfNotNull(out); writeCRLF(out); writeContentTypeIfNotNull(out); writeCRLF(out); writeContent(out); writeCRLF(out); } AbstractPart(String name); @Override void write(OutputStream out); @Override String getName();  }