### Question:
UtilStream { public static File getCopy(String name, InputStream input) { Check.notNull(name); Check.notNull(input); final String prefix; final String suffix; final int minimumPrefix = 3; final int i = name.lastIndexOf(Constant.DOT); if (i > minimumPrefix) { prefix = name.substring(0, i); suffix = name.substring(i); } else { if (name.length() > minimumPrefix) { prefix = name; } else { prefix = PREFIX_TEMP; } suffix = null; } try { final File temp = File.createTempFile(prefix, suffix); try (OutputStream output = new BufferedOutputStream(new FileOutputStream(temp))) { copy(input, output); } return temp; } catch (final IOException exception) { throw new LionEngineException(exception, ERROR_TEMP_FILE + name); } } private  UtilStream(); static void copy(InputStream source, OutputStream destination); static File getCopy(String name, InputStream input);  }### Answer:
@Test void testGetCopy() throws IOException { try (InputStream input = new InputStreamMock()) { assertTrue(UtilStream.getCopy("te", input).delete()); assertTrue(UtilStream.getCopy("temp", input).delete()); assertTrue(UtilStream.getCopy("temp.tmp", input).delete()); } }
@Test void testGetCopyNullName() throws IOException { try (InputStream input = new InputStreamMock()) { assertThrows(() -> UtilStream.getCopy(null, input), Check.ERROR_NULL); } }
@Test void testGetCopyNullStream() throws IOException { assertThrows(() -> UtilStream.getCopy("temp", null), Check.ERROR_NULL); }
@Test void testGetCopyError() { assertThrows(() -> UtilStream.getCopy("copy", new InputStream() { @Override public int read() throws IOException { throw new IOException(); } }), UtilStream.ERROR_TEMP_FILE + "copy"); }