diff options
author | Janos Gyerik <janos.gyerik@sonarsource.com> | 2019-01-17 07:32:31 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-02-11 09:11:46 +0100 |
commit | dced64bda1caa518354c12c05a70c167ad280a15 (patch) | |
tree | 383988f1c17c4acab2d547ad95bb3bcf0e409eb0 /sonar-testing-harness | |
parent | 96e54a89a4cfa87e304d0978d3a829b30deb99ed (diff) | |
download | sonarqube-dced64bda1caa518354c12c05a70c167ad280a15.tar.gz sonarqube-dced64bda1caa518354c12c05a70c167ad280a15.zip |
SONAR-11626 Add new WS project_analyses/set_baseline
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r-- | sonar-testing-harness/src/main/java/org/sonar/test/Matchers.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/Matchers.java b/sonar-testing-harness/src/main/java/org/sonar/test/Matchers.java new file mode 100644 index 00000000000..216683f8273 --- /dev/null +++ b/sonar-testing-harness/src/main/java/org/sonar/test/Matchers.java @@ -0,0 +1,48 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.test; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +/** + * Utility class to provide various Matchers to use in ExpectedException.expectMessage. + */ +public class Matchers { + + private Matchers() { + // utility class, forbidden constructor + } + + public static Matcher<String> regexMatcher(String regex) { + return new TypeSafeMatcher<String>() { + @Override + protected boolean matchesSafely(String item) { + return item.matches(regex); + } + + @Override + public void describeTo(Description description) { + description.appendText("matching regex ").appendValue(regex); + } + }; + } +} |