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 c806e664..d27fcbb0 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(); + } }