Liran Zelkha has posted comments on this change. Change subject: core: make DbFacade a CDI singleton ......................................................................
Patch Set 31: (4 comments) http://gerrit.ovirt.org/#/c/34814/31/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/MacPoolValidatorTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/MacPoolValidatorTest.java: Line 47: } Line 48: Line 49: private MacPoolValidator createMacPoolValidator(MacPool macPool) { Line 50: MacPoolValidator macPoolValidator = spy(new MacPoolValidator(macPool)); Line 51: doReturn(dbFacadeMock).when(macPoolValidator).getDbFacade(); > Isn't it redundant now you extend CommonCodeTest? Here we make sure that the macPoolValidator returns a correct DbFacade. Without it, the tests fail on NPE. It's a macPoolValidator behavior, rather than the test behavior. Line 52: return macPoolValidator; Line 53: } Line 54: Line 55: @Test http://gerrit.ovirt.org/#/c/34814/31/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SearchQueryTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SearchQueryTest.java: Line 39: import org.ovirt.engine.core.searchbackend.SearchObjectAutoCompleter; Line 40: import org.ovirt.engine.core.searchbackend.SearchObjects; Line 41: import org.ovirt.engine.core.utils.MockConfigRule; Line 42: Line 43: @RunWith(Theories.class) > I'm not sure why do you need Theories here. Done Line 44: public class SearchQueryTest extends CommonCodeTest { Line 45: Line 46: @ClassRule Line 47: public static MockConfigRule mcr = new MockConfigRule( Line 305: } Line 306: Line 307: private SearchQuery<SearchParameters> spySearchQuery(SearchParameters searchParam) { Line 308: SearchQuery<SearchParameters> searchQuery = spy(new SearchQuery<SearchParameters>(searchParam)); Line 309: doReturn(mockDAO()).when(searchQuery).getDbFacade(); > Isn't it redundant now? Since SearchQuery has a getDbFacade method - we need to make sure it returns the right mock. From that perspective there was no change in the code. (Now, if we would inject DbFacade everywhere - we could remove this line - but that's outside the scope of this patch) Line 310: return searchQuery; Line 311: } Line 312: Line 313: @Test http://gerrit.ovirt.org/#/c/34814/31/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/macpoolmanager/MacPoolPerDcTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/macpoolmanager/MacPoolPerDcTest.java: Line 74: pool.initialize(); Line 75: Mockito.verify(macPoolDao).getAll(); Line 76: Line 77: pool.initialize(); Line 78: Mockito.verify(macPoolDao).getAll(); > Why did you remove Mockito.verifyNoMoreInteractions(storagePoolDao, vmNicDa Good catch. Thanks! I fixed it (although dbFacade had to be removed as the member was removed) Line 79: } Line 80: Line 81: @Test() Line 82: public void testPoolDoesNotExistForGivenDataCenter() throws Exception { -- To view, visit http://gerrit.ovirt.org/34814 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic9e57710ce8353af020cb5ae53e43b127276d6c6 Gerrit-PatchSet: 31 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches