diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-10 20:42:03 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-14 20:37:37 +0100 |
commit | 4a5be9fbaba0b9729e909eec935852c56f6e71e2 (patch) | |
tree | f6f73398d587abf3c2dd460bb9a8813a99b95fc6 /sonar-scanner-engine/src/test | |
parent | 93c6c4ccda2bf18fc651b215576172810a1f8725 (diff) | |
download | sonarqube-4a5be9fbaba0b9729e909eec935852c56f6e71e2.tar.gz sonarqube-4a5be9fbaba0b9729e909eec935852c56f6e71e2.zip |
Upgrade Mockito from 1.10.19 to 2.13.0
Diffstat (limited to 'sonar-scanner-engine/src/test')
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java | 16 | ||||
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java | 17 |
2 files changed, 9 insertions, 24 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java index 161d44b6fe5..1cda6fd4e15 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java @@ -21,9 +21,9 @@ package org.sonar.scanner; import java.io.InputStream; import java.io.Reader; +import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; +import org.mockito.ArgumentMatcher; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; @@ -71,7 +71,7 @@ public class WsTestUtil { verify(mock).call(argThat(new RequestMatcher(path))); } - private static class RequestMatcher extends BaseMatcher<WsRequest> { + private static class RequestMatcher implements ArgumentMatcher<WsRequest> { private String path; public RequestMatcher(String path) { @@ -79,17 +79,11 @@ public class WsTestUtil { } @Override - public boolean matches(Object item) { + public boolean matches(@Nullable WsRequest item) { if (item == null) { return false; } - WsRequest request = (WsRequest) item; - return StringUtils.equals(request.getPath(), path); - } - - @Override - public void describeTo(Description description) { - description.appendText("request path (\"" + path + "\")"); + return StringUtils.equals(item.getPath(), path); } } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java index 190db162aa0..04bdf6cf150 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ContextPropertiesPublisherTest.java @@ -24,8 +24,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.hamcrest.Description; -import org.hamcrest.TypeSafeMatcher; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -91,17 +89,10 @@ public class ContextPropertiesPublisherTest { } private void expectWritten(List<ScannerReport.ContextProperty> expected) { - verify(writer).writeContextProperties(argThat(new TypeSafeMatcher<Iterable<ScannerReport.ContextProperty>>() { - @Override - protected boolean matchesSafely(Iterable<ScannerReport.ContextProperty> props) { - List<ScannerReport.ContextProperty> copy = Lists.newArrayList(props); - copy.removeAll(expected); - return copy.isEmpty(); - } - - @Override - public void describeTo(Description description) { - } + verify(writer).writeContextProperties(argThat(props -> { + List<ScannerReport.ContextProperty> copy = Lists.newArrayList(props); + copy.removeAll(expected); + return copy.isEmpty(); })); } |