Moti Asayag has posted comments on this change.
Change subject: core: New AssertUtils Class
......................................................................
Patch Set 2: (2 inline comments)
....................................................
File
backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/AssertUtils.java
Line 10: * A utility class for static asserting methods.
Line 11: */
Line 12: public class AssertUtils {
Line 13:
Line 14: public static <T> void assertEqualsIgnoreOrder(List<T> list1,
List<T> list2) {
You can replace the List type with Collection to be less depended on the
implementation since all used methods of List in this function: size() and
contains() exists in java.util.Collection
Line 15: assertNotNull(list1);
Line 16: assertNotNull(list2);
Line 17: assertEquals(list1.size(), list2.size());
Line 18: for (T element : list1) {
Line 15: assertNotNull(list1);
Line 16: assertNotNull(list2);
Line 17: assertEquals(list1.size(), list2.size());
Line 18: for (T element : list1) {
Line 19: assertTrue(list2.contains(element));
instead of the for loop you can use:
assertTrue(list1.containsAll(list2))
The only problem with this class is the following case:
* list1: A, A, B
* list2: A, B, B
The lists aren't equals, although containing the same elements.
In this case the return value of this method is false positive.
Line 20: }
Line 21: }
--
To view, visit http://gerrit.ovirt.org/8698
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I37b8ab50adc2b9866b9c15414905a79bdce903f2
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Muli Salem <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: Muli Salem <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches