Change in ovirt-engine[master]: core: StorageDomainDaoTest assertNulls

amureini at redhat.com amureini at redhat.com
Mon Feb 1 17:15:05 UTC 2016


Allon Mureinik has submitted this change and it was merged.

Change subject: core: StorageDomainDaoTest assertNulls
......................................................................


core: StorageDomainDaoTest assertNulls

executeReadList's contract specifies that when a method that returns a
List has no data it returns an empty list, not a null. Thus, asserting
this is wrong on several levels:
1. It represents a break in the abstraction - a unit test should only
   assert the behavior of the class its testing, not other classes.
2. It's pointless, as the contents of the list are always checked
   immediately afterwards. If the list were null, the test would just
   error out with a NullPointerException.

This patch removes those aforementioned useless asserts. Once they are
removed, the assertCorrectGetAllResult becomes a wrapper to asserting a
list is not empty, so it was just inlined.

Change-Id: I84ea47545ed9f4bf2375187843906da942c92d7e
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainDaoTest.java
1 file changed, 2 insertions(+), 30 deletions(-)

Approvals:
  Tal Nisan: Looks good to me, approved
  Eli Mesika: Looks good to me, but someone else must approve
  Allon Mureinik: Verified; Passed CI tests



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I84ea47545ed9f4bf2375187843906da942c92d7e
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: Eli Mesika <emesika at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list