### Question:
Results { public void addResult(String path, int lineNumber, List<String> lines) { Validate.notBlank(path, "Invalid file/path"); Validate.notEmpty(lines); Validate.isTrue(lineNumber > 0, "line numbers must be positive"); List<ErrorResult> list = results.get(path); if (isNull(list)) { addFile(path); list = results.get(path); } ErrorResult errorResult = new ErrorResult(lineNumber, lines); list.add(errorResult); logger.debug("Adding Result: {}", errorResult); }  void addFile(String filePath); void addResult(String path, int lineNumber, List<String> lines); void clear(); void generate(Formatter formatter, Publisher publisher);  }### Answer:
@Test(expected = NullPointerException.class) public void testAddResult_with_null_path() { instance.addResult(null, 0, null); }
@Test(expected = IllegalArgumentException.class) public void testAddResult_with_empty_path() { instance.addResult("", 0, null); }
@Test(expected = NullPointerException.class) public void testAddResult_with_null_list() { instance.addResult("valid/path", 10, null); }
@Test(expected = IllegalArgumentException.class) public void testAddResult_with_empty_list() { List<String> empty = Collections.emptyList(); instance.addResult("valid/path", 10, empty); }
@Test(expected = IllegalArgumentException.class) public void testAddResult_with_invalid_line_number() { List<String> list = new ArrayList<String>(); list.add("hello"); instance.addResult("valid/path", 0, list); }
@Test public void testAddResult_with_valid_data() { final String path = "/use/local/myfile.log"; List<String> list = getList("hello", "world"); instance.addResult(path, 10, list); @SuppressWarnings("unchecked") Map<String, List<Results.ErrorResult>> results = (Map<String, List<ErrorResult>>) ReflectionTestUtils .getField(instance, "results"); assertEquals(1, results.size()); validateResults(path, results, "hello", "world"); }
@Test public void testAddResult_with_valid_data_multiple_entries() { final String path1 = "/use/local/myfile1.log"; final String path2 = "/use/local/myfile2.log"; List<String> list = getList("hello1", "world1"); instance.addResult(path1, 10, list); list = getList("hello2", "world2"); instance.addResult(path2, 10, list); @SuppressWarnings("unchecked") Map<String, List<Results.ErrorResult>> results = (Map<String, List<ErrorResult>>) ReflectionTestUtils .getField(instance, "results"); assertEquals(2, results.size()); validateResults(path1, results, "hello1", "world1"); validateResults(path2, results, "hello2", "world2"); }
@Test public void testAddResult_with_valid_data_multiple_errors() { final String path1 = "/use/local/myfile1.log"; List<String> list = getList("hello1", "world1"); instance.addResult(path1, 10, list); list = getList("hello2", "world2"); instance.addResult(path1, 10, list); @SuppressWarnings("unchecked") Map<String, List<Results.ErrorResult>> results = (Map<String, List<ErrorResult>>) ReflectionTestUtils .getField(instance, "results"); assertEquals(1, results.size()); List<Results.ErrorResult> result = results.get(path1); assertEquals(2, result.size()); }