@Test public void testWriteWhenFileIsInPackageShouldCreateFolderStructure() throws IOException { String directories = "com/epam/wilma"; given(file.getParent()).willReturn(directories); given(fileOutputStreamFactory.createFileOutputStream(file)).willReturn(fileOutputStream); underTest.write(inputStream, FILE_NAME, EXCEPTION_MESSAGE); verify(fileFactory.createFile(directories)).mkdirs(); }
public void write(final InputStream inputStream, final String fileName, final String exceptionMessage) { boolean isClass = fileName.endsWith(".class"); boolean isJar = fileName.endsWith(".jar"); if (isClass) { writeClass(fileName, inputStream, exceptionMessage); } else if (isJar) { writeJar(fileName, inputStream, exceptionMessage); } else { writeOther(fileName, inputStream, exceptionMessage); } }
FileWriter { public void write(final InputStream inputStream, final String fileName, final String exceptionMessage) { boolean isClass = fileName.endsWith(".class"); boolean isJar = fileName.endsWith(".jar"); if (isClass) { writeClass(fileName, inputStream, exceptionMessage); } else if (isJar) { writeJar(fileName, inputStream, exceptionMessage); } else { writeOther(fileName, inputStream, exceptionMessage); } } }
FileWriter { public void write(final InputStream inputStream, final String fileName, final String exceptionMessage) { boolean isClass = fileName.endsWith(".class"); boolean isJar = fileName.endsWith(".jar"); if (isClass) { writeClass(fileName, inputStream, exceptionMessage); } else if (isJar) { writeJar(fileName, inputStream, exceptionMessage); } else { writeOther(fileName, inputStream, exceptionMessage); } }  }
FileWriter { public void write(final InputStream inputStream, final String fileName, final String exceptionMessage) { boolean isClass = fileName.endsWith(".class"); boolean isJar = fileName.endsWith(".jar"); if (isClass) { writeClass(fileName, inputStream, exceptionMessage); } else if (isJar) { writeJar(fileName, inputStream, exceptionMessage); } else { writeOther(fileName, inputStream, exceptionMessage); } }  void write(final InputStream inputStream, final String fileName, final String exceptionMessage); }
FileWriter { public void write(final InputStream inputStream, final String fileName, final String exceptionMessage) { boolean isClass = fileName.endsWith(".class"); boolean isJar = fileName.endsWith(".jar"); if (isClass) { writeClass(fileName, inputStream, exceptionMessage); } else if (isJar) { writeJar(fileName, inputStream, exceptionMessage); } else { writeOther(fileName, inputStream, exceptionMessage); } }  void write(final InputStream inputStream, final String fileName, final String exceptionMessage);  }