Skip to content

Commit 5ef354e

Browse files
committed
Fix tests
1 parent 802a575 commit 5ef354e

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

plugin/src/test/java/jenkins/plugins/openstack/compute/internal/OpenstackTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package jenkins.plugins.openstack.compute.internal;
22

33
import static org.hamcrest.MatcherAssert.assertThat;
4-
import static org.hamcrest.Matchers.anEmptyMap;
54
import static org.hamcrest.Matchers.containsString;
65
import static org.hamcrest.Matchers.equalTo;
76
import static org.junit.Assert.fail;
@@ -190,7 +189,7 @@ public void getImageIdsForGivenNameThenReturnsMatchingImageIdsSortedByAge() {
190189
when(mockIS.list(anyMapOf(String.class, String.class))).thenReturn(images);
191190
final ArrayList<String> expected = new ArrayList<>(
192191
Arrays.asList("mockImageNamedBar2Id", "mockImageNamedBar3Id", "mockImageNamedBar1Id"));
193-
final OSClient osClient = mock(OSClient.class);
192+
194193
when(osClient.imagesV2()).thenReturn(mockIS);
195194

196195

@@ -208,7 +207,7 @@ public void getImageIdsForGivenNameThenReturnsMatchingImageIdsSortedByAge() {
208207
public void getImageIdsForGivenUnknownThenReturnsEmpty() {
209208
final ImageService mockIS = mock(ImageService.class);
210209
when(mockIS.list(anyMapOf(String.class, String.class))).thenReturn(Collections.EMPTY_LIST);
211-
final OSClient osClient = mock(OSClient.class);
210+
212211
when(osClient.imagesV2()).thenReturn(mockIS);
213212
final ArrayList<String> expected = new ArrayList<>();
214213

@@ -233,7 +232,7 @@ public void getImageIdsForGivenIdOfActiveImageThenReturnsId() {
233232
final ImageService mockIS = mock(ImageService.class);
234233
when(mockIS.list(anyMapOf(String.class, String.class))).thenReturn(Collections.EMPTY_LIST);
235234
when(mockIS.get(imageId)).thenReturn(mockImageNamedFoo);
236-
final OSClient osClient = mock(OSClient.class);
235+
237236
when(osClient.imagesV2()).thenReturn(mockIS);
238237
final ArrayList<String> expected = new ArrayList<>(Arrays.asList(mockImageNamedFoo.getId()));
239238

@@ -271,7 +270,7 @@ public void getVolumeSnapshotIdsForGivenNameThenReturnsMatchingVolumeSnapshotIds
271270
final List volumeSnapshots = Arrays.asList(mockVolumeSnapshotNamedFoo, mockVolumeSnapshotNamedBar1,
272271
mockVolumeSnapshotNamedBar2, mockVolumeSnapshotNamedBar3);
273272
when(mockBVSS.list()).thenReturn(volumeSnapshots);
274-
final OSClient osClient = mock(OSClient.class, RETURNS_DEEP_STUBS);
273+
275274
when(osClient.blockStorage().snapshots()).thenReturn(mockBVSS);
276275
final ArrayList<String> expected = new ArrayList<>(Arrays.asList("mockVolumeSnapshotNamedBar2Id",
277276
"mockVolumeSnapshotNamedBar3Id", "mockVolumeSnapshotNamedBar1Id"));
@@ -312,7 +311,7 @@ public void getVolumeSnapshotIdsForGivenUnknownThenReturnsEmpty() {
312311
final List volumeSnapshots = Arrays.asList(mockVolumeSnapshotNamedFoo, mockVolumeSnapshotNamedBar1,
313312
mockVolumeSnapshotNamedBar2, mockVolumeSnapshotNamedBar3);
314313
when(mockBVSS.list()).thenReturn(volumeSnapshots);
315-
final OSClient osClient = mock(OSClient.class, RETURNS_DEEP_STUBS);
314+
316315
when(osClient.blockStorage().snapshots()).thenReturn(mockBVSS);
317316
final ArrayList<String> expected = new ArrayList<>();
318317

@@ -351,7 +350,7 @@ public void getVolumeSnapshotIdsForGivenIdOfActiveVolumeSnapshotThenReturnsId()
351350
final BlockVolumeSnapshotService mockBVSS = mock(BlockVolumeSnapshotService.class);
352351
when(mockBVSS.list()).thenReturn(volumeSnapshots);
353352
when(mockBVSS.get(volumeSnapshotId)).thenReturn(mockVolumeSnapshotNamedFoo);
354-
final OSClient osClient = mock(OSClient.class, RETURNS_DEEP_STUBS);
353+
355354
when(osClient.blockStorage().snapshots()).thenReturn(mockBVSS);
356355
final ArrayList<String> expected = new ArrayList<>(Arrays.asList(mockVolumeSnapshotNamedFoo.getId()));
357356

@@ -374,7 +373,7 @@ public void getAvailabilityZonesReturnsAZsSortedByName() {
374373
when(mockAZ3.getZoneName()).thenReturn("Flibble");
375374
final ZoneService mockZS = mock(ZoneService.class);
376375
doReturn(Arrays.asList(mockAZ1, mockAZ2, mockAZ3)).when(mockZS).list();
377-
final OSClient osClient = mock(OSClient.class, RETURNS_DEEP_STUBS);
376+
378377
when(osClient.compute().zones()).thenReturn(mockZS);
379378
final ArrayList<AvailabilityZone> expected = new ArrayList<>(Arrays.asList(mockAZ2, mockAZ3, mockAZ1));
380379

0 commit comments

Comments
 (0)