From 578a5e8377c9aacd1e1297bbac72dfd9d8f9def5 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 11 Dec 2020 21:11:45 -0800 Subject: [PATCH] Use Collections#singletonList where possible --- core/src/test/java/hudson/FunctionsTest.java | 4 ++-- core/src/test/java/hudson/cli/ListJobsCommandTest.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/hudson/FunctionsTest.java b/core/src/test/java/hudson/FunctionsTest.java index 13631b7e0f..bb5eb4e039 100644 --- a/core/src/test/java/hudson/FunctionsTest.java +++ b/core/src/test/java/hudson/FunctionsTest.java @@ -144,7 +144,7 @@ public class FunctionsTest { when(j.getItemGroup()).thenReturn(j); createMockAncestors(req, createAncestor(view, "."), createAncestor(j, "../..")); TopLevelItem i = createMockItem(parent, "job/i/"); - when(view.getItems()).thenReturn(Arrays.asList(i)); + when(view.getItems()).thenReturn(Collections.singletonList(i)); String result = Functions.getRelativeLinkTo(i); assertEquals("job/i/", result); } @@ -201,7 +201,7 @@ public class FunctionsTest { when(parent.getItemGroup()).thenReturn(parent); createMockAncestors(req, createAncestor(j, "../../.."), createAncestor(parent, "../.."), createAncestor(view, ".")); TopLevelItem i = createMockItem(parent, "job/i/", "parent/job/i/"); - when(view.getItems()).thenReturn(Arrays.asList(i)); + when(view.getItems()).thenReturn(Collections.singletonList(i)); String result = Functions.getRelativeLinkTo(i); assertEquals("job/i/", result); } diff --git a/core/src/test/java/hudson/cli/ListJobsCommandTest.java b/core/src/test/java/hudson/cli/ListJobsCommandTest.java index a329e4f30a..a301909d46 100644 --- a/core/src/test/java/hudson/cli/ListJobsCommandTest.java +++ b/core/src/test/java/hudson/cli/ListJobsCommandTest.java @@ -16,6 +16,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -117,7 +118,7 @@ public class ListJobsCommandTest { when(rootView.getViews()).thenReturn(Arrays.asList(leftView, rightView)); when(rootView.getItems()).thenReturn(Arrays.asList(rootJob, sharedJob)); when(leftView.getItems()).thenReturn(Arrays.asList(leftJob, sharedJob)); - when(rightView.getItems()).thenReturn(Arrays.asList(rightJob)); + when(rightView.getItems()).thenReturn(Collections.singletonList(rightJob)); when(jenkins.getView("Root")).thenReturn(rootView);