@Test public void failsWhenMessageBodyWriterForItemEntityIsNotAvailable() throws Exception { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); OutputItem item1 = anOutputItem().withName("item1").withEntity("item1 entity").withMediaType(TEXT_PLAIN_TYPE).withFilename("item1.txt").build(); thrown.expect(RuntimeException.class); multipartFormDataWriter.writeItems(newArrayList(item1), bOut, "1234567".getBytes()); }
public void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary) throws IOException { for (OutputItem item : items) { writeItem(item, output, boundary); } output.write(HYPHENS); output.write(boundary); output.write(HYPHENS); output.write(NEW_LINE); }
MultipartFormDataWriter { public void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary) throws IOException { for (OutputItem item : items) { writeItem(item, output, boundary); } output.write(HYPHENS); output.write(boundary); output.write(HYPHENS); output.write(NEW_LINE); } }
MultipartFormDataWriter { public void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary) throws IOException { for (OutputItem item : items) { writeItem(item, output, boundary); } output.write(HYPHENS); output.write(boundary); output.write(HYPHENS); output.write(NEW_LINE); } MultipartFormDataWriter(Providers providers); }
MultipartFormDataWriter { public void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary) throws IOException { for (OutputItem item : items) { writeItem(item, output, boundary); } output.write(HYPHENS); output.write(boundary); output.write(HYPHENS); output.write(NEW_LINE); } MultipartFormDataWriter(Providers providers); void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary); }
MultipartFormDataWriter { public void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary) throws IOException { for (OutputItem item : items) { writeItem(item, output, boundary); } output.write(HYPHENS); output.write(boundary); output.write(HYPHENS); output.write(NEW_LINE); } MultipartFormDataWriter(Providers providers); void writeItems(Collection<OutputItem> items, OutputStream output, byte[] boundary);  }