diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2017-05-12 14:53:40 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2017-05-12 14:53:40 +0200 |
commit | d4b74ece1f2cd2140efd6368a2c0f3e1b715f562 (patch) | |
tree | 5ab9e548a1c42442873c38b72bf6db70f9d5e1b7 /sonar-scanner-engine/src/test | |
parent | c3f190771bfaf1104985bdec74391599956bc66e (diff) | |
download | sonarqube-d4b74ece1f2cd2140efd6368a2c0f3e1b715f562.tar.gz sonarqube-d4b74ece1f2cd2140efd6368a2c0f3e1b715f562.zip |
Fix quality flaws
Diffstat (limited to 'sonar-scanner-engine/src/test')
2 files changed, 10 insertions, 13 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java index fde5ad8024c..065dc0bcc4b 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java @@ -36,8 +36,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.function.Function; - +import java.util.function.Consumer; import javax.annotation.Nullable; import org.apache.commons.io.FileUtils; import org.sonar.api.CoreProperties; @@ -456,9 +455,9 @@ public class ScannerMediumTester { } @Override - public void load(String componentKey, Function<ServerIssue, Void> consumer) { + public void load(String componentKey, Consumer<ServerIssue> consumer) { for (ServerIssue serverIssue : serverIssues) { - consumer.apply(serverIssue); + consumer.accept(serverIssue); } } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java index 07674ace549..be9bfb44768 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java @@ -19,19 +19,18 @@ */ package org.sonar.scanner.repository; -import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; -import org.sonar.scanner.repository.DefaultServerIssuesLoader; -import org.junit.Before; -import org.junit.Test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import java.util.function.Function; +import java.util.function.Consumer; +import org.junit.Before; +import org.junit.Test; +import org.sonar.scanner.WsTestUtil; +import org.sonar.scanner.bootstrap.ScannerWsClient; +import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -62,7 +61,6 @@ public class DefaultServerIssuesLoaderTest { final List<ServerIssue> result = new ArrayList<>(); loader.load("foo", issue -> { result.add(issue); - return null; }); assertThat(result).extracting("key").containsExactly("ab1", "ab2"); @@ -73,6 +71,6 @@ public class DefaultServerIssuesLoaderTest { InputStream is = mock(InputStream.class); when(is.read()).thenThrow(IOException.class); WsTestUtil.mockStream(wsClient, "/batch/issues.protobuf?key=foo", is); - loader.load("foo", mock(Function.class)); + loader.load("foo", mock(Consumer.class)); } } |