Change in ovirt-engine[master]: core: Remove redundant command spying
amureini at redhat.com
amureini at redhat.com
Tue Oct 25 09:42:22 UTC 2016
Allon Mureinik has submitted this change and it was merged.
Change subject: core: Remove redundant command spying
......................................................................
core: Remove redundant command spying
@Spying a command and then mocking behavior with
do[Return|Answer|Nothing] is a common practice in BLL's tests which
originated from the need to mock DAOs' behavior.
After the recent changes, the commands' DAOs are injected, so in many
scenarios using @Spy is redundant, and @InjectMocks is sufficient to
introduce the required dependencies.
This patch removes these redundant spying by doing the following:
- Remove the @Spy annotation where possible
- Using straight-forward setter methods instead of spying the behavior
of getters with doReturn. This has an added bonus of testing another
method of the command, albeit a simple one.
Change-Id: I828e0f55cec9ccbe873636ca40afb8bbbcf1daf3
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AbstractRolesCommandTestBase.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddClusterCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddExternalStepCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddQuotaCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddVdsSpmIdCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AutoRecoveryManagerTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ClearExternalJobCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/EndExternalJobCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/EndExternalStepCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveAuditLogByIdCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveQuotaCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateRngDeviceTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateWatchdogCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/hostdeploy/InstallVdsInternalCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/hostdeploy/UpgradeOvirtNodeInternalCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/hostedengine/HostedEngineConfigFetcherTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/commands/AddAffinityGroupCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBaseTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/disk/MoveDisksCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/ActivateStorageDomainCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/domain/AddStorageDomainCommonTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/pool/ForceSelectSPMCommandTest.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/repoimage/ExportRepoImageCommandTest.java
M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBaseTest.java
25 files changed, 2 insertions(+), 53 deletions(-)
Approvals:
Tal Nisan: Looks good to me, approved
Allon Mureinik: Verified; Passed CI tests
--
To view, visit https://gerrit.ovirt.org/64981
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I828e0f55cec9ccbe873636ca40afb8bbbcf1daf3
Gerrit-PatchSet: 14
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: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
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