Change in ovirt-engine[master]: core: MockConfigRule default values

Allon Mureinik has submitted this change and it was merged. Change subject: core: MockConfigRule default values ...................................................................... core: MockConfigRule default values Enhance MockConfigRule to return the default value of a config value if its not explicitly mocked. Note that now the MockConfigRule depends on production code from the utils module, so modules that do not depend on it must have it added (in the test scope) This change has four main advantages: 1. Ease of use: With this change, not every config value has to be mocked, only the ones the developer is explicitly interested in. 2. Better simulation: With this change, tests with MockConfigRule act more like production code - if a config value is missing in their [mocked] environment, the default value is used. 3. Ease of maintenance: With this change, adding a new config value dependency in the production code won't break all the tests with a NullPointerException. Instead, the tests will silently use the default value. 4. Ease of reading: With this change, the only MockCongfigDescriptors that need to be used are for exceptional values that differ from the defaults. This way, these values draw the reader's attention to their special nature and allow him to focus on them instead of loosing them between all the values that just mock their defaults. NOTE: The SearchQueryTest relies on the old behavior. In order to not break it, nulls were explicitly mocked where expected by that old test. Change-Id: I32c99fd9cba88d2f58db4878565251a30a0bf125 Signed-off-by: Allon Mureinik <amureini@redhat.com> --- M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/SearchQueryTest.java M backend/manager/modules/searchbackend/pom.xml M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/MockConfigRule.java 3 files changed, 21 insertions(+), 1 deletion(-) Approvals: Tal Nisan: Looks good to me, approved Allon Mureinik: Verified; Passed CI tests -- To view, visit https://gerrit.ovirt.org/65032 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I32c99fd9cba88d2f58db4878565251a30a0bf125 Gerrit-PatchSet: 6 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <amureini@redhat.com> Gerrit-Reviewer: Allon Mureinik <amureini@redhat.com> Gerrit-Reviewer: Eli Mesika <emesika@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Martin Peřina <mperina@redhat.com> Gerrit-Reviewer: Tal Nisan <tnisan@redhat.com> Gerrit-Reviewer: gerrit-hooks <automation@ovirt.org>
participants (1)
-
amureini@redhat.com