aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/testFixtures/java
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-12-04 12:50:58 +0100
committersonartech <sonartech@sonarsource.com>2023-12-04 20:03:22 +0000
commitd62a56ecfd4cf2f183873900fd32cffc4743c7fb (patch)
tree552481ceb8b8cab34f74b59563b58278ffa62f69 /sonar-ws/src/testFixtures/java
parentcdda3dbcdd4e4b5f4a2e7471a37fa66877e26aad (diff)
downloadsonarqube-d62a56ecfd4cf2f183873900fd32cffc4743c7fb.tar.gz
sonarqube-d62a56ecfd4cf2f183873900fd32cffc4743c7fb.zip
SONAR-21174 Fix code smells raised after dropping JDK11 support
Diffstat (limited to 'sonar-ws/src/testFixtures/java')
-rw-r--r--sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/GroupTester.java4
-rw-r--r--sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QGateTester.java3
-rw-r--r--sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QProfileTester.java3
-rw-r--r--sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/SettingTester.java6
-rw-r--r--sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/UserTester.java3
5 files changed, 7 insertions, 12 deletions
diff --git a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/GroupTester.java b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/GroupTester.java
index bf36e3b4d8e..00bff8cdccd 100644
--- a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/GroupTester.java
+++ b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/GroupTester.java
@@ -88,7 +88,7 @@ public class GroupTester {
public GroupTester deleteAllGenerated() {
List<String> allGroups = session.wsClient().userGroups().search(new SearchRequest()).getGroupsList().stream().map(UserGroups.Group::getName)
- .collect(Collectors.toList());
+ .toList();
allGroups.stream()
.filter(g -> g.matches("Group\\d+$"))
.forEach(g -> session.wsClient().userGroups().delete(new DeleteRequest().setName(g)));
@@ -97,7 +97,7 @@ public class GroupTester {
public GroupTester delete(UserGroups.Group... groups) {
List<String> allGroups = session.wsClient().userGroups().search(new SearchRequest()).getGroupsList().stream().map(UserGroups.Group::getName)
- .collect(Collectors.toList());
+ .toList();
stream(groups)
.filter(g -> allGroups.contains(g.getName()))
.forEach(g -> session.wsClient().userGroups().delete(new DeleteRequest().setName(g.getName())));
diff --git a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QGateTester.java b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QGateTester.java
index 232949dffa5..b7efbfc9d2f 100644
--- a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QGateTester.java
+++ b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QGateTester.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.client.qualitygates.CreateRequest;
import org.sonarqube.ws.client.qualitygates.DestroyRequest;
@@ -54,7 +53,7 @@ public class QGateTester {
void deleteAll() {
List<ListWsResponse.QualityGate> builtInQualityGates = session.wsClient().qualitygates().list(new ListRequest()).getQualitygatesList().stream()
.filter(ListWsResponse.QualityGate::getIsBuiltIn)
- .collect(Collectors.toList());
+ .toList();
if (builtInQualityGates.size() == 1) {
session.wsClient().qualitygates().setAsDefault(new SetAsDefaultRequest().setName(builtInQualityGates.get(0).getName()));
}
diff --git a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QProfileTester.java b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QProfileTester.java
index 99202a15657..71130367f8d 100644
--- a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QProfileTester.java
+++ b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/QProfileTester.java
@@ -27,7 +27,6 @@ package org.sonarqube.ws.tester;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.Qualityprofiles;
@@ -60,7 +59,7 @@ public class QProfileTester {
.filter(qp -> !qp.getIsDefault())
.filter(qp -> !qp.getIsBuiltIn())
.filter(qp -> qp.getParentKey() == null || qp.getParentKey().equals(""))
- .collect(Collectors.toList());
+ .toList();
qualityProfiles.forEach(
qp -> session.wsClient().qualityprofiles().delete(new DeleteRequest().setQualityProfile(qp.getName()).setLanguage(qp.getLanguage())));
diff --git a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/SettingTester.java b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/SettingTester.java
index abc45cacac0..c38b997b958 100644
--- a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/SettingTester.java
+++ b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/SettingTester.java
@@ -19,11 +19,9 @@
*/
package org.sonarqube.ws.tester;
-import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import org.sonarqube.ws.Settings;
@@ -38,7 +36,7 @@ import static java.util.Arrays.asList;
public class SettingTester {
- private static final Set<String> EMAIL_SETTINGS = ImmutableSet.of("email.smtp_host.secured", "email.smtp_port.secured", "email.smtp_secure_connection.secured",
+ private static final Set<String> EMAIL_SETTINGS = Set.of("email.smtp_host.secured", "email.smtp_port.secured", "email.smtp_secure_connection.secured",
"email.smtp_username.secured", "email.smtp_password.secured", "email.from", "email.prefix");
private final TesterSession session;
@@ -59,7 +57,7 @@ public class SettingTester {
.map(Settings.Definition::getKey)
.filter(key -> !key.equals(Tester.FORCE_AUTHENTICATION_PROPERTY_NAME)),
EMAIL_SETTINGS.stream())
- .collect(Collectors.toList());
+ .toList();
session.wsClient().settings().reset(new ResetRequest().setKeys(settingKeys));
}
diff --git a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/UserTester.java b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/UserTester.java
index 7966560052b..f5dbe9bb912 100644
--- a/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/UserTester.java
+++ b/sonar-ws/src/testFixtures/java/org/sonarqube/ws/tester/UserTester.java
@@ -25,7 +25,6 @@ import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonarqube.ws.UserTokens;
import org.sonarqube.ws.Users;
@@ -179,7 +178,7 @@ public class UserTester {
private Optional<Users.SearchWsResponse.User> queryForUser(String login, Predicate<Users.SearchWsResponse.User> predicate) {
List<Users.SearchWsResponse.User> users = session.wsClient().users().search(new SearchRequest().setQ(login)).getUsersList().stream()
- .filter(predicate).collect(Collectors.toList());
+ .filter(predicate).toList();
if (users.size() == 1) {
return Optional.of(users.get(0));
}