### Question:
FileServiceImpl implements FileService { @Override public File compressToZipFile(List<File> documents, boolean removeCompressed) throws IOException { Preconditions.checkNotNull(documents, "documents argument is nullable."); Preconditions.checkArgument(!documents.isEmpty(), "documents list can't be empty"); File zipFile = createExportFile("documents.zip"); FileOutputStream fos = new FileOutputStream(zipFile); ZipOutputStream zos = new ZipOutputStream(fos); try { for (File document : documents) { ZipEntry ze = new ZipEntry(document.getName()); zos.putNextEntry(ze); FileInputStream in = new FileInputStream(document); IOUtils.copy(in, zos); IOUtils.closeQuietly(in); zos.closeEntry(); if (removeCompressed) { remove(document.getAbsolutePath()); } } } finally { IOUtils.closeQuietly(zos); } return zipFile; } FileServiceImpl(); static FileService getInstance(); @Value("${reportPath}") void setUploadDirectory(final String uploadDirectory); @Override String getName(final String path); @Override String getLastModificationDate(final String path); @Override String getUrl(final String path); @Override String getPathFromUrl(final String url); @Override InputStream getInputStream(final String path); @Override String upload(final MultipartFile multipartFile); @Override File createExportFile(final String filename); @Override File createReportFile(final String fileName); File getFileFromFilenameWithRandomDirectory(final String filename); @Override Entity updateReportFileName(final Entity entity, final String dateFieldName, final String name); @Override Entity updateReportFileName(final Entity entity, final String dateFieldName, final String name, final String... args); @Override File compressToZipFile(List<File> documents, boolean removeCompressed); @Override String getContentType(final String path); @Override void remove(final String path);  }### Answer:
@Test(expected = NullPointerException.class) public void shouldThrowNullPointerException(){ try { fileService.compressToZipFile(null, true); } catch (IOException e) { } }
@Test(expected = IllegalArgumentException.class) public void shouldThrowIllegalArgumentException(){ try { fileService.compressToZipFile(new ArrayList<File>(), true); } catch (IOException e) { } }