### Question:
UtilStream { public static void copy(InputStream source, OutputStream destination) throws IOException { Check.notNull(source); Check.notNull(destination); final byte[] buffer = new byte[BUFFER_COPY]; while (true) { final int read = source.read(buffer); if (read == -1) { break; } destination.write(buffer, 0, read); } } private  UtilStream(); static void copy(InputStream source, OutputStream destination); static File getCopy(String name, InputStream input);  }### Answer:
@Test void testCopy() throws IOException { final Path temp1 = Files.createTempFile("temp", ".tmp"); final Path temp2 = Files.createTempFile("temp", ".tmp"); try (InputStream input = new FileInputStream(temp1.toFile()); OutputStream output = new FileOutputStream(temp2.toFile())) { output.write(1); output.flush(); UtilStream.copy(input, output); } finally { Files.delete(temp1); Files.delete(temp2); } }
@Test void testCopyNullInput() throws IOException { try (OutputStream output = new OutputStreamMock()) { assertThrows(() -> UtilStream.copy(null, output), Check.ERROR_NULL); } }
@Test void testCopyNullOutput() throws IOException { try (InputStream input = new InputStreamMock()) { assertThrows(() -> UtilStream.copy(input, null), Check.ERROR_NULL); } }