diff options
author | David Gageot <david@gageot.net> | 2012-05-25 09:09:52 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-05-25 09:10:09 +0200 |
commit | c6dc564b20d039045b6f5ce90232c19dab520abb (patch) | |
tree | c692278d37b9e101101577efee075990b82e9230 /plugins/sonar-checkstyle-plugin | |
parent | 7c03664400952bb5497e07a76e4d26bd9a22b7d3 (diff) | |
download | sonarqube-c6dc564b20d039045b6f5ce90232c19dab520abb.tar.gz sonarqube-c6dc564b20d039045b6f5ce90232c19dab520abb.zip |
Technical debt : Replace BaseMatcher with ArgumentMatcher
Diffstat (limited to 'plugins/sonar-checkstyle-plugin')
-rw-r--r-- | plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleExecutorTest.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleExecutorTest.java b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleExecutorTest.java index 6aa825974fa..f92e2259af3 100644 --- a/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleExecutorTest.java +++ b/plugins/sonar-checkstyle-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleExecutorTest.java @@ -23,8 +23,8 @@ import com.puppycrawl.tools.checkstyle.api.AuditEvent; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; import org.junit.Test; +import org.mockito.ArgumentMatcher; import java.io.File; import java.nio.charset.Charset; @@ -35,7 +35,12 @@ import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; import static org.junit.internal.matchers.StringContains.containsString; import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.*; +import static org.mockito.Matchers.argThat; +import static org.mockito.Mockito.atLeast; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class CheckstyleExecutorTest { @@ -69,26 +74,22 @@ public class CheckstyleExecutorTest { } private BaseMatcher<AuditEvent> newErrorMatcher(final String filename, final String rule) { - return new BaseMatcher<AuditEvent>(){ + return new ArgumentMatcher<AuditEvent>() { + @Override public boolean matches(Object o) { AuditEvent event = (AuditEvent)o; return StringUtils.endsWith(event.getFileName(), filename) && StringUtils.equals(event.getSourceName(), rule); } - - public void describeTo(Description description) { - } }; } private BaseMatcher<AuditEvent> newFilenameMatcher(final String filename) { - return new BaseMatcher<AuditEvent>(){ + return new ArgumentMatcher<AuditEvent>() { + @Override public boolean matches(Object o) { AuditEvent event = (AuditEvent)o; return StringUtils.endsWith(event.getFileName(), filename); } - - public void describeTo(Description description) { - } }; } |