diff --git a/src/main/java/hudson/plugins/textfinder/TextFinderPublisher.java b/src/main/java/hudson/plugins/textfinder/TextFinderPublisher.java index 547537a..7266416 100644 --- a/src/main/java/hudson/plugins/textfinder/TextFinderPublisher.java +++ b/src/main/java/hudson/plugins/textfinder/TextFinderPublisher.java @@ -128,7 +128,8 @@ private void findText(Run run, FilePath workspace, TaskListener listener) boolean foundText = false; if (alsoCheckConsoleOutput) { - logger.println("Looking for pattern " + "'" + regexp + "'" + " in the console output"); + logger.println( + "Looking for pattern " + "'" + regexp + "'" + " in the console output"); foundText |= checkFile( run.getLogFile(), @@ -140,7 +141,15 @@ private void findText(Run run, FilePath workspace, TaskListener listener) // printing this when checking console output will cause the plugin // to find this line, which would be pointless. // doing this only when fileSet!=null to avoid - logger.println("Looking for pattern " + "'" + regexp + "'" + " in the file " + "'" + run.getLogFile() + "'"); + logger.println( + "Looking for pattern " + + "'" + + regexp + + "'" + + " in the file " + + "'" + + run.getLogFile() + + "'"); } final RemoteOutputStream ros = new RemoteOutputStream(logger); diff --git a/src/test/java/hudson/plugins/textfinder/TextFinderPublisherAgentTest.java b/src/test/java/hudson/plugins/textfinder/TextFinderPublisherAgentTest.java index 85b0c5e..f9a7e1e 100644 --- a/src/test/java/hudson/plugins/textfinder/TextFinderPublisherAgentTest.java +++ b/src/test/java/hudson/plugins/textfinder/TextFinderPublisherAgentTest.java @@ -62,7 +62,16 @@ public void failureIfFoundInFileOnAgent() throws Exception { agent.getNodeName(), agent.getNodeName()))); WorkflowRun build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the file " + "'" + build.getLogFile() + "'", build); + rule.assertLogContains( + "Looking for pattern " + + "'" + + UNIQUE_TEXT + + "'" + + " in the file " + + "'" + + build.getLogFile() + + "'", + build); assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false); rule.assertBuildStatus(Result.FAILURE, build); } @@ -79,7 +88,9 @@ public void failureIfFoundInConsoleOnAgent() throws Exception { agent.getNodeName(), agent.getNodeName()))); WorkflowRun build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern " + "'" + ECHO_UNIQUE_TEXT + "'" + " in the console output", build); + rule.assertLogContains( + "Looking for pattern " + "'" + ECHO_UNIQUE_TEXT + "'" + " in the console output", + build); assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true); rule.assertBuildStatus(Result.FAILURE, build); } diff --git a/src/test/java/hudson/plugins/textfinder/TextFinderPublisherFreestyleTest.java b/src/test/java/hudson/plugins/textfinder/TextFinderPublisherFreestyleTest.java index 7906033..8b5d11c 100644 --- a/src/test/java/hudson/plugins/textfinder/TextFinderPublisherFreestyleTest.java +++ b/src/test/java/hudson/plugins/textfinder/TextFinderPublisherFreestyleTest.java @@ -48,7 +48,8 @@ public void successIfFoundInConsole() throws Exception { project.getPublishersList().add(textFinder); FreeStyleBuild build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); + rule.assertLogContains( + "Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true); rule.assertBuildStatus(Result.SUCCESS, build); } @@ -66,7 +67,8 @@ public void failureIfFoundInConsole() throws Exception { project.getPublishersList().add(textFinder); FreeStyleBuild build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); + rule.assertLogContains( + "Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true); rule.assertBuildStatus(Result.FAILURE, build); } @@ -85,7 +87,8 @@ public void unstableIfFoundInConsole() throws Exception { project.getPublishersList().add(textFinder); FreeStyleBuild build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); + rule.assertLogContains( + "Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true); rule.assertBuildStatus(Result.UNSTABLE, build); } @@ -98,7 +101,8 @@ public void notFoundInConsole() throws Exception { project.getPublishersList().add(textFinder); FreeStyleBuild build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); + rule.assertLogContains( + "Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build); rule.assertBuildStatus(Result.SUCCESS, build); } } diff --git a/src/test/java/hudson/plugins/textfinder/TextFinderPublisherPipelineTest.java b/src/test/java/hudson/plugins/textfinder/TextFinderPublisherPipelineTest.java index 1e63b4a..8d7e148 100644 --- a/src/test/java/hudson/plugins/textfinder/TextFinderPublisherPipelineTest.java +++ b/src/test/java/hudson/plugins/textfinder/TextFinderPublisherPipelineTest.java @@ -58,7 +58,9 @@ public void successIfFoundInFile() throws Exception { + "node {findText regexp: 'foobar', fileSet: 'out.txt', succeedIfFound: true}\n")); WorkflowRun build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build); + rule.assertLogContains( + "Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", + build); assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false); rule.assertBuildStatus(Result.SUCCESS, build); } @@ -72,7 +74,9 @@ public void failureIfFoundInFile() throws Exception { + "node {findText regexp: 'foobar', fileSet: 'out.txt'}\n")); WorkflowRun build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build); + rule.assertLogContains( + "Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", + build); assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false); rule.assertBuildStatus(Result.FAILURE, build); } @@ -86,7 +90,9 @@ public void unstableIfFoundInFile() throws Exception { + "node {findText regexp: 'foobar', fileSet: 'out.txt', unstableIfFound: true}\n")); WorkflowRun build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build); + rule.assertLogContains( + "Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", + build); assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false); rule.assertBuildStatus(Result.UNSTABLE, build); } @@ -114,7 +120,9 @@ public void notFoundInFile() throws Exception { + "node {findText regexp: 'foobar', fileSet: 'out.txt'}\n")); WorkflowRun build = project.scheduleBuild2(0).get(); rule.waitForCompletion(build); - rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build); + rule.assertLogContains( + "Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", + build); rule.assertBuildStatus(Result.SUCCESS, build); }