diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/aether/ArtifactTransporter.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/aether/ArtifactTransporter.java index e0dd82226..306bed126 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/aether/ArtifactTransporter.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/aether/ArtifactTransporter.java @@ -2,7 +2,6 @@ import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import org.apache.maven.repository.internal.MavenRepositorySystemUtils; import org.eclipse.aether.DefaultRepositorySystemSession; @@ -34,7 +33,7 @@ public class ArtifactTransporter { public ArtifactTransporter(Path localRepositoryLocation, RemoteRepository... remoteLocations) { this.localRepositoryLocation = localRepositoryLocation; - this.remoteLocations = Arrays.asList(remoteLocations); + this.remoteLocations = List.of(remoteLocations); // todo: proxies: https://github.com/jenkinsci/acceptance-test-harness/blob/b27c150f35a386dfced4a5960127bf62f9c34363/src/main/java/org/jenkinsci/test/acceptance/utils/aether/ArtifactResolverUtil.java } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java index 4832d428f..45db90de2 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java @@ -3,7 +3,6 @@ import static net.serenitybdd.screenplay.Tasks.instrumented; import com.smartcodeltd.jenkinsci.plugins.build_monitor.tasks.configuration.SaveTheChangesToBuildMonitor; -import java.util.Arrays; import java.util.List; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Performable; @@ -14,7 +13,7 @@ public class ConfigureEmptyBuildMonitorView implements Task { public static ConfigureEmptyBuildMonitorView to(Task... configurationTasks) { - return instrumented(ConfigureEmptyBuildMonitorView.class, Arrays.asList(configurationTasks)); + return instrumented(ConfigureEmptyBuildMonitorView.class, List.of(configurationTasks)); } @Override diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java index c581d04c4..1dded85b5 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java @@ -3,7 +3,6 @@ import static net.serenitybdd.screenplay.Tasks.instrumented; import com.smartcodeltd.jenkinsci.plugins.build_monitor.user_interface.BuildMonitorDashboard; -import java.util.Arrays; import java.util.List; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Performable; @@ -15,7 +14,7 @@ public class ModifyControlPanelOptions implements Task { public static ModifyControlPanelOptions to(Task... configurationTasks) { - return instrumented(ModifyControlPanelOptions.class, Arrays.asList(configurationTasks)); + return instrumented(ModifyControlPanelOptions.class, List.of(configurationTasks)); } @Override diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java index 6174d0db5..323f63dbb 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java @@ -3,7 +3,6 @@ import static net.serenitybdd.screenplay.Tasks.instrumented; import com.sonyericsson.jenkins.plugins.bfa.user_interface.JenkinsHomePageWithBFA; -import java.util.Arrays; import java.util.List; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Task; @@ -14,7 +13,7 @@ public class UseFailureCauseManagement implements Task { public static UseFailureCauseManagement to(Task... defineFailureCauses) { - return instrumented(UseFailureCauseManagement.class, Arrays.asList(defineFailureCauses)); + return instrumented(UseFailureCauseManagement.class, List.of(defineFailureCauses)); } @Step("{0} uses the 'Failure Cause Management'") diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java index 3128150ae..d68b4ac53 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java @@ -1,7 +1,6 @@ package net.serenitybdd.integration.jenkins; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import net.serenitybdd.integration.jenkins.environment.rules.ApplicativeTestRule; @@ -20,11 +19,11 @@ public JenkinsInstance create() { } public > TestEnvironment beforeStart(ATR... rules) { - return beforeStart(Arrays.asList(rules)); + return beforeStart(List.of(rules)); } public > TestEnvironment afterStart(ATR... rules) { - return afterStart(Arrays.asList(rules)); + return afterStart(List.of(rules)); } public > TestEnvironment beforeStart(List rules) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java index db1d32c30..663cb35af 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java @@ -6,7 +6,6 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import net.serenitybdd.integration.jenkins.process.JenkinsProcess; @@ -164,8 +163,8 @@ private int executeCommand(String... args) { //TODO use RealJenkinsRule //return executor.call(args).execute(noManualInput(), info(logger), error(logger)); try { - List cliArgs = new ArrayList<>(Arrays.asList("-s", jenkinsUrl.toString(), "-http")); - cliArgs.addAll(Arrays.asList(args)); + List cliArgs = new ArrayList<>(List.of("-s", jenkinsUrl.toString(), "-http")); + cliArgs.addAll(List.of(args)); return CLI._main(cliArgs.toArray(new String[0])); } catch (Exception e) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java index 21f042759..bf1dddfa4 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java @@ -10,7 +10,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,7 +23,7 @@ public class UpdateCenter { = "https://updates.jenkins.io/update-center.json?version=%s"; private final Path tempDir; - private List jenkinsLTSVersions = Arrays.asList( + private List jenkinsLTSVersions = List.of( Version.valueOf("2.375.4"), Version.valueOf("2.375.3"), Version.valueOf("2.375.2"), diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java index f1bff98e0..d13b2774c 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java @@ -5,7 +5,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; -import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import net.serenitybdd.integration.jenkins.JenkinsInstance; @@ -23,7 +22,7 @@ public class InstallPluginsFromDisk implements ApplicativeTestRule args = new ArrayList<>(windowsOrUnix(executable)); - args.addAll(Arrays.asList(arguments)); + args.addAll(List.of(arguments)); return new ProcessBuilder(args); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java index 22dd2185e..4f45c29e2 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java @@ -1,13 +1,12 @@ package net.serenitybdd.integration.utils; -import java.util.Arrays; import java.util.List; import org.junit.rules.RuleChain; import org.junit.rules.TestRule; public class RuleChains { public static RuleChain from(TestRule... rules) { - return from(Arrays.asList(rules)); + return from(List.of(rules)); } private static RuleChain from(List testRules) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java index 5386b03bb..71f35fd88 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java @@ -2,7 +2,6 @@ import static net.serenitybdd.screenplay.Tasks.instrumented; -import java.util.Arrays; import java.util.List; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Interaction; @@ -13,7 +12,7 @@ public class EnterCode { public static EnterCode asFollows(String... lines) { - return new EnterCode(Arrays.asList(lines)); + return new EnterCode(List.of(lines)); } public Interaction intoTheCodeMirror(Target editorField) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/TodoList.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/TodoList.java index 18555bebb..108b499a4 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/TodoList.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/TodoList.java @@ -3,7 +3,6 @@ import static net.serenitybdd.screenplay.Tasks.instrumented; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import net.serenitybdd.screenplay.Actor; import net.serenitybdd.screenplay.Performable; @@ -21,7 +20,7 @@ public TodoList add(T task) { } public TodoList addAll(T... tasks) { - todos.addAll(Arrays.asList(tasks)); + todos.addAll(List.of(tasks)); return this; } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java index e5ec2b537..82066dead 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java @@ -1,8 +1,8 @@ package net.serenitybdd.screenplay.jenkins.tasks.configuration.build_steps; -import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; public class GroovyScript { @@ -17,7 +17,7 @@ public GroovyScript separatedBy(String lineSeparator) { } public GroovyScript definedAs(String... lines) { - return this.definedAs(Arrays.asList(lines)); + return this.definedAs(List.of(lines)); } public GroovyScript definedAs(List lines) { @@ -27,7 +27,7 @@ public GroovyScript definedAs(List lines) { } public GroovyScript andOutputs(String... lines) { - return definedAs(Arrays.stream(lines).map(line -> String.format("echo \"%s\";", line)).collect(Collectors.toList())); + return definedAs(Stream.of(lines).map(line -> String.format("echo \"%s\";", line)).collect(Collectors.toList())); } public String code() { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java index f9d682939..c66b8f152 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java @@ -1,8 +1,8 @@ package net.serenitybdd.screenplay.jenkins.tasks.configuration.build_steps; -import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; public class ShellScript { @@ -11,7 +11,7 @@ public static ShellScript that(String descriptionOfScriptsBehaviour) { } public ShellScript definedAs(String... lines) { - return this.definedAs(Arrays.asList(lines)); + return this.definedAs(List.of(lines)); } public ShellScript definedAs(List lines) { @@ -21,7 +21,7 @@ public ShellScript definedAs(List lines) { } public ShellScript andOutputs(String... lines) { - return definedAs(Arrays.stream(lines).map(line -> String.format("echo \"%s\";", line)).collect(Collectors.toList())); + return definedAs(Stream.of(lines).map(line -> String.format("echo \"%s\";", line)).collect(Collectors.toList())); } public String code() { diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java index 8ab1ff17b..719b48d05 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java @@ -4,7 +4,6 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; -import java.util.Arrays; import java.util.Collection; import java.util.List; import org.junit.Test; @@ -55,7 +54,7 @@ private static class TestNode { TestNode(String displayName, Type type, TestNode[] parents) { this.displayName = displayName; this.type = type; - this.parents = Arrays.asList(parents); + this.parents = List.of(parents); } String getDisplayName() { diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java index 24d44ba32..ea9bccb3d 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java @@ -4,7 +4,6 @@ import static org.hamcrest.core.Is.is; import com.smartcodeltd.jenkinsci.plugins.buildmonitor.readability.Lister; -import java.util.Arrays; import java.util.List; import org.junit.Test; @@ -46,6 +45,6 @@ public void should_allow_to_use_a_different_template_to_describe_a_list_with_one } private List listOf(T... items) { - return Arrays.asList(items); + return List.of(items); } } \ No newline at end of file diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java index 8376a0f9c..a2965a3de 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java @@ -5,7 +5,6 @@ import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features.Feature; import hudson.model.Job; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.function.Supplier; @@ -24,7 +23,7 @@ public JobViewRecipe of(Job job) { } public JobViewRecipe which(Feature... features) { - this.features = Arrays.asList(features); + this.features = List.of(features); return this; } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java index ada01ea7f..7fcfba1fa 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.function.Supplier; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @author Jan Molak @@ -15,7 +16,7 @@ public static List asFollows(T... examples) { } public static List asFollows(Supplier... examples) { - return Arrays.stream(examples).map(Supplier::get).collect(Collectors.toList()); + return Stream.of(examples).map(Supplier::get).collect(Collectors.toList()); } -} \ No newline at end of file +}