@Test public void shouldNotWriteToOutputStreamIfEmpty() throws IOException { OutputStream out = mock(OutputStream.class); multipart.write(out); verify(out, never()).write(Matchers.any(byte[].class)); }
@Override public void write(OutputStream out) throws IOException { if (parts.size() == 0) { return; } writeParts(out); }
Multipart implements Collection<Part>, Writable { @Override public void write(OutputStream out) throws IOException { if (parts.size() == 0) { return; } writeParts(out); } }
Multipart implements Collection<Part>, Writable { @Override public void write(OutputStream out) throws IOException { if (parts.size() == 0) { return; } writeParts(out); } Multipart();  Multipart(String boundary); }
Multipart implements Collection<Part>, Writable { @Override public void write(OutputStream out) throws IOException { if (parts.size() == 0) { return; } writeParts(out); } Multipart();  Multipart(String boundary); @Override void write(OutputStream out); String getContentType(); @Override boolean add(Part part); @Override boolean addAll(Collection<? extends Part> collection); @Override void clear(); @Override boolean contains(Object obj); @Override boolean containsAll(Collection<?> collection); @Override boolean isEmpty(); @Override Iterator<Part> iterator(); @Override boolean remove(Object obj); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection); @Override Object[] toArray(); @SuppressWarnings("hiding") @Override Part[] toArray(Part[] array); @Override int size(); String getBoundary(); }
Multipart implements Collection<Part>, Writable { @Override public void write(OutputStream out) throws IOException { if (parts.size() == 0) { return; } writeParts(out); } Multipart();  Multipart(String boundary); @Override void write(OutputStream out); String getContentType(); @Override boolean add(Part part); @Override boolean addAll(Collection<? extends Part> collection); @Override void clear(); @Override boolean contains(Object obj); @Override boolean containsAll(Collection<?> collection); @Override boolean isEmpty(); @Override Iterator<Part> iterator(); @Override boolean remove(Object obj); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection); @Override Object[] toArray(); @SuppressWarnings("hiding") @Override Part[] toArray(Part[] array); @Override int size(); String getBoundary();  }