Skip to content

Instantly share code, notes, and snippets.

@slide
Created December 7, 2020 19:16
Show Gist options
  • Save slide/f5a82e4f683ec475b1eaf02512620b7f to your computer and use it in GitHub Desktop.
Save slide/f5a82e4f683ec475b1eaf02512620b7f to your computer and use it in GitHub Desktop.
@Test
public void testPropertyTest() throws Exception {
FreeStyleProject project = j.createFreeStyleProject("tester");
project.getBuildersList().add(new TestBuilder() {
@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
listener.getLogger().println("[2020-12-07T12:06:20.387Z] SonarQube task 'AXY9F-obrAIK9ZVmoTfZ' completed. Quality gate is 'ERROR'");
return true;
}
});
FreeStyleBuild b = project.scheduleBuild2(0).get();
assertEquals(" 'ERROR'",TokenMacro.expand(b, StreamTaskListener.fromStdout(),
"${LOG_REGEX,regex=\"^.*?completed\\. Quality gate is(.*?$)\",replacement=\"\\\\1\"}"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment