From db9ec1900ebfe2c5bfce0b4a462b84db795d380a Mon Sep 17 00:00:00 2001 From: arus2023 Date: Mon, 25 Sep 2023 19:37:28 -0500 Subject: [PATCH] Removed 1 unnecessary stubbing in AutofilledNetworkConfigurationTest.java --- .../AutofilledNetworkConfigurationTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/google/jenkins/plugins/computeengine/AutofilledNetworkConfigurationTest.java b/src/test/java/com/google/jenkins/plugins/computeengine/AutofilledNetworkConfigurationTest.java index c806e6644..d27fcbb02 100644 --- a/src/test/java/com/google/jenkins/plugins/computeengine/AutofilledNetworkConfigurationTest.java +++ b/src/test/java/com/google/jenkins/plugins/computeengine/AutofilledNetworkConfigurationTest.java @@ -94,7 +94,7 @@ public void testDoCheckNetworkItemsValid() { @Test public void testDoFillSubnetworkItemsEmptyRegion() throws IOException { - DescriptorImpl descriptor = subnetworkFillDescriptorSetup(ImmutableList.of(SUBNETWORK_NAME)); + DescriptorImpl descriptor = subnetworkFillDescriptorSetup2(ImmutableList.of(SUBNETWORK_NAME)); ListBoxModel got = descriptor.doFillSubnetworkItems(r.jenkins, "", "", PROJECT_ID, CREDENTIALS_ID); Assert.assertEquals(0, got.size()); @@ -160,4 +160,14 @@ private DescriptorImpl subnetworkFillDescriptorSetup(List subnetworkName DescriptorImpl.setComputeClient(computeClient); return new DescriptorImpl(); } + + private DescriptorImpl subnetworkFillDescriptorSetup2(List subnetworkNames) + throws IOException { + List subnetworks = new ArrayList<>(); + subnetworkNames.forEach( + subnet -> subnetworks.add(new Subnetwork().setName(subnet).setSelfLink(subnet))); + ComputeClient computeClient = Mockito.mock(ComputeClient.class); + DescriptorImpl.setComputeClient(computeClient); + return new DescriptorImpl(); + } }