### Question:
HttpProcessor { public List<HttpMatchResult> processFile(File file) { if (file == null) { throw new IllegalArgumentException("file cannot be null"); } if (!file.exists()) { throw new IllegalArgumentException(file + " does not exist"); } if (!file.isFile()) { throw new IllegalArgumentException(file + " must be a valid file (i.e. not a directory)"); } List<HttpMatchResult> matches = processHttpInFile(file); matches.forEach(match -> { this.httpMatches.add(match.getHttp()); }); return matches; }  List<HttpMatchResult> processFile(File file); Set<String> getHttpMatches();  }### Answer:
@Test public void processFileWhenNullThenIllegalArgumentException() { assertThatCode(() -> this.processor.processFile(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("file cannot be null"); }
@Test public void processFileWhenFolderThenIllegalArgumentException() throws IOException { File dir = this.temp.newFolder(); assertThatCode(() -> this.processor.processFile(dir)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(dir + " must be a valid file (i.e. not a directory)"); }
@Test public void processFileWhenDoesNotExistIllegalArgumentException() throws IOException { File notExists = new File("doesnotexist"); assertThatCode(() -> this.processor.processFile(notExists)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(notExists + " does not exist"); }
@Test public void processFileWhenEmptyResultsThenWorks() throws IOException { File file = this.temp.newFile(); assertThat(this.processor.processFile(file)).isEmpty(); assertThat(this.processor.files).containsOnly(file); }