Update XenServer610WrapperTest.java (#8139)

* Update XenServer610WrapperTest.java

* Apply suggestions from code review

Co-authored-by: Rohit Yadav <rohityadav89@gmail.com>

---------

Co-authored-by: Rohit Yadav <rohityadav89@gmail.com>
This commit is contained in:
gzhao9 2023-11-03 07:48:48 -04:00 committed by GitHub
parent ec3d0f54fe
commit 39c0706f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -259,8 +259,8 @@ public class XenServer610WrapperTest {
final Connection conn = Mockito.mock(Connection.class);
final VirtualMachineTO vmSpec = Mockito.mock(VirtualMachineTO.class);
final VolumeTO volume1 = Mockito.mock(VolumeTO.class);
final VolumeTO volume2 = Mockito.mock(VolumeTO.class);
final VolumeTO volume1 = MockVolumeTO(path);
final VolumeTO volume2 = MockVolumeTO(path);
final SR sr1 = Mockito.mock(SR.class);
final SR sr2 = Mockito.mock(SR.class);
@ -295,9 +295,6 @@ public class XenServer610WrapperTest {
when(xenServer610Resource.getConnection()).thenReturn(conn);
when(vmSpec.getName()).thenReturn(vmName);
when(volume1.getPath()).thenReturn(path);
when(volume2.getPath()).thenReturn(path);
when(nic1.getMac()).thenReturn(mac);
when(nic2.getMac()).thenReturn(mac);
@ -369,8 +366,8 @@ public class XenServer610WrapperTest {
final Connection conn = Mockito.mock(Connection.class);
final VirtualMachineTO vmSpec = Mockito.mock(VirtualMachineTO.class);
final VolumeTO volume1 = Mockito.mock(VolumeTO.class);
final VolumeTO volume2 = Mockito.mock(VolumeTO.class);
final VolumeTO volume1 = MockVolumeTO(path);
final VolumeTO volume2 = MockVolumeTO(path);
final SR sr1 = Mockito.mock(SR.class);
final SR sr2 = Mockito.mock(SR.class);
@ -399,9 +396,6 @@ public class XenServer610WrapperTest {
when(xenServer610Resource.getConnection()).thenReturn(conn);
when(vmSpec.getName()).thenReturn(vmName);
when(volume1.getPath()).thenReturn(path);
when(volume2.getPath()).thenReturn(path);
when(xenServer610Resource.getVDIbyUuid(conn, volume1.getPath())).thenReturn(vdi1);
when(xenServer610Resource.getVDIbyUuid(conn, volume2.getPath())).thenReturn(vdi2);
@ -481,4 +475,10 @@ public class XenServer610WrapperTest {
assertFalse(answer.getResult());
}
VolumeTO MockVolumeTO(String path){
VolumeTO vol = Mockito.mock(VolumeTO.class);
when(vol.getPath()).thenReturn(path);
return vol;
}
}