Mike Kolesnik has posted comments on this change.
Change subject: engine: Refactored code into NetworkValidator class
......................................................................
Patch Set 10: (3 inline comments)
....................................................
File
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/NetworkValidatorTest.java
Line 41: private final String NAMEABLE_NAME = "nameable";
Line 42: private final String DEFAULT_NETWORK_NAME = "mynetwork";
Line 43: private final String OTHER_NETWORK_NAME = "myothernetwork";
Line 44: private final Guid DEFAULT_GUID = new
Guid("00000000-0000-0000-0000-000000000000");
Line 45: private final Guid OTHER_GUID = new
Guid("00000000-0000-0000-0000-000000000001");
Is it necessary to initialize the Guids to a specific value, or is
Guid.NewGuid() good enough?
Line 46: private final int DEFAULT_VLAN_ID = 0;
Line 47: private final int OTHER_VLAN_ID = 1;
Line 48:
Line 49: @Rule
Line 84:
when(networkDao.getAllForDataCenter(any(Guid.class))).thenReturn(networks);
Line 85:
Line 86: // mock version checking
Line 87: Version version = mock(Version.class);
Line 88: when(version.getValue()).thenReturn(null);
This line is unnecessary since this is the default behaviour of the mock
Line 89:
when(dataCenter.getcompatibility_version()).thenReturn(version);
Line 90: }
Line 91:
Line 92: @Test
Line 101: }
Line 102:
Line 103: @Test
Line 104: public void dataCenterDoesntExist() throws Exception {
Line 105: doReturn(null).when(validator).getDataCenter();
I think it would be more correct to mock the DAO to return null.
Line 106: assertEquals(new
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST),
Line 107: validator.dataCenterExists());
Line 108: }
Line 109:
--
To view, visit http://gerrit.ovirt.org/10940
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Icf40d81f0481c6b6dec141a71363888dc9e9a941
Gerrit-PatchSet: 10
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: Livnat Peer <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches