Change in ovirt-engine[master]: core: Use a default answer for MockConfigRule

Code Review gerrit at ovirt.org
Wed Mar 15 06:26:08 UTC 2017


>From Allon Mureinik <amureini at redhat.com>:

Allon Mureinik has submitted this change and it was merged.

Change subject: core: Use a default answer for MockConfigRule
......................................................................


core: Use a default answer for MockConfigRule

Before this patch, MockConfigRule used the Answers.CALLS_REAL_METHODS
default answer and another Answer to implement the logic of returning
the default config value. This meant that it was still performing a
stubbing operation, which could potentially cause some tests to fail
with an UnnecessaryStubbingException and forcing those tests to use
the Silent runner.

This patch unifies the parts of the stubbing logic to a single
default answer, meaning that this mock now has no stubbing recorded
on it, making it safe to use with the normal MockitoJUnitRunner.

Another side effect this patch has is that it consolidates the
mocking to a single mock object instead of [re]creating it each test,
which should, at least in theory, offer a slight performance
improvement.

Change-Id: If2dcd48aad2596b379eb694d0bf36788ea0f5611
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/MockConfigRule.java
1 file changed, 19 insertions(+), 13 deletions(-)

Approvals:
  Tal Nisan: Looks good to me, approved
  Jenkins CI: Passed CI tests
  Allon Mureinik: Verified



-- 
To view, visit https://gerrit.ovirt.org/73944
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If2dcd48aad2596b379eb694d0bf36788ea0f5611
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Martin Peřina <mperina at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Yevgeny Zaspitsky <yzaspits at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the Engine-commits mailing list