### Question:
JenkinsLinterErrorBuilder { public JenkinsLinterError build(String line) { if (line==null){ return null; } Matcher matcher = ERROR_PATTERN.matcher(line); if (! matcher.find()){ return null; } JenkinsLinterError error = new JenkinsLinterError(); error.message=line; error.line = Integer.valueOf(matcher.group(1)); error.column = Integer.valueOf(matcher.group(2)); return error; }  JenkinsLinterError build(String line);  }### Answer:
@Test public void workflowscript_missing_required_againt_at_line_1_comma_column1__is_recognized_as_error() { String line = "WorkflowScript: 1: Missing required section \"agent\" @ line 1, column 1."; JenkinsLinterError error = builderToTest.build(line); assertNotNull(error); assertEquals(1,error.getLine()); assertEquals(1,error.getColumn()); assertEquals(line,error.getMessage()); }
@Test public void workflowscript_no_stages_specified_at_line_3_comma_column2__is_recognized_as_error() { String line = "WorkflowScript: 2: No stages specified @ line 3, column 2."; JenkinsLinterError error = builderToTest.build(line); assertNotNull(error); assertEquals(3,error.getLine()); assertEquals(2,error.getColumn()); assertEquals(line,error.getMessage()); }
@Test public void workflowscript_no_stages_specified_at_line_3000_comma_column22__is_recognized_as_error() { String line = "WorkflowScript: 2: No stages specified @ line 3000, column 22."; JenkinsLinterError error = builderToTest.build(line); assertNotNull(error); assertEquals(3000,error.getLine()); assertEquals(22,error.getColumn()); assertEquals(line,error.getMessage()); }
@Test public void errors_encountered_validating_jenkinsfile_is_not_an_error_itself() { String line = "Errors encountered validating Jenkinsfile:"; JenkinsLinterError error = builderToTest.build(line); assertNull(error); }
@Test public void infotext_about_pipeline_code_is_not_a_error() { String line = " pipeline{"; JenkinsLinterError error = builderToTest.build(line); assertNull(error); }