Martin Mucha has posted comments on this change. Change subject: core: tests for NetworkAttachmentValidator ......................................................................
Patch Set 40: (4 comments) https://gerrit.ovirt.org/#/c/36570/40/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/NetworkAttachmentValidatorTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/NetworkAttachmentValidatorTest.java: Line 197: Line 198: @Test Line 199: public void testIpConfiguredForStaticBootProtocolWhenIpConfigurationIsNotNullAndBootProtocolIsStaticAndAddressIsNull() throws Exception { Line 200: NetworkAttachment attachment = Line 201: createNetworkAttachmentWithIpConfiguration(NetworkBootProtocol.STATIC_IP, null, ""); > null and "" are considered as empty strings. I would except the following t Done Line 202: Line 203: assertThat(new NetworkAttachmentValidator(attachment, new VDS(), managementNetworkUtil).ipConfiguredForStaticBootProtocol(), Line 204: failsWith(VdcBllMessages.NETWORK_ADDR_MANDATORY_IN_STATIC_IP)); Line 205: } Line 205: } Line 206: Line 207: @Test Line 208: public void testIpConfiguredForStaticBootProtocolWhenIpConfigurationIsNotNullAndBootProtocolIsStaticAndNetmaskIsNull() throws Exception { Line 209: NetworkAttachment attachment = > same- null and "" are considered as empty strings. I would except the follo Done Line 210: createNetworkAttachmentWithIpConfiguration(NetworkBootProtocol.STATIC_IP, "", null); Line 211: Line 212: assertThat(new NetworkAttachmentValidator(attachment, new VDS(), managementNetworkUtil).ipConfiguredForStaticBootProtocol(), Line 213: failsWith(VdcBllMessages.NETWORK_ADDR_MANDATORY_IN_STATIC_IP)); Line 263: assertThat(new NetworkAttachmentValidator(attachment, host, managementNetworkUtil).bootProtocolSetForDisplayNetwork(), isValid()); Line 264: } Line 265: Line 266: @Test Line 267: public void testBootProtocolSetForDisplayNetworkWhenIpConfigurationIsNull() throws Exception { > has a lot of common with the previous method, please extract. Done Line 268: Network network = new Network(); Line 269: network.setId(Guid.newGuid()); Line 270: Line 271: NetworkAttachment attachment = new NetworkAttachment(); Line 306: when(networkDaoMock.get(Mockito.eq(network.getId()))).thenReturn(network); Line 307: Line 308: assertThat(new NetworkAttachmentValidator(attachment, host, managementNetworkUtil).bootProtocolSetForDisplayNetwork(), Line 309: failsWith(VdcBllMessages.ACTION_TYPE_FAILED_DISPLAY_NETWORK_HAS_NO_BOOT_PROTOCOL)); Line 310: } > Please add a valid test for display network (there is a valid test just for Done Line 311: Line 312: @Test Line 313: public void testNicExistsWhenNicNameIsNull() throws Exception { Line 314: NetworkAttachment attachment = new NetworkAttachment(); -- To view, visit https://gerrit.ovirt.org/36570 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia4ba4327b93f8628e234e0e2b23234d8b89902b5 Gerrit-PatchSet: 40 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <mmu...@redhat.com> Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Martin Mucha <mmu...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches