Mike Kolesnik has posted comments on this change.
Change subject: core: Added LexoNumericComparator utility
......................................................................
Patch Set 1: (2 inline comments)
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/LexoNumericComparator.java
Line 21: public int compare(String str1, String str2) {
Line 22: return comp(str1, str2);
Line 23: }
Line 24:
Line 25: public static int comp(String str1, String str2) {
Why is this a public method?
Line 26: if (str1 == null) {
Line 27: return (str2 == null) ? 0 : -1;
Line 28: } else if (str2 == null) {
Line 29: return 1;
....................................................
File
backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/LexoNumericComparatorTest.java
Line 12: private final String NONDIGIT_OTHER = "def";
Line 13: private LexoNumericComparator comparator = new
LexoNumericComparator();
Line 14:
Line 15: private void verifyResult(String str1, String str2, int
expectedResult) {
Line 16: assertEquals(Integer.signum(expectedResult),
Integer.signum(comparator.compare(str1, str2)));
Perhaps it would be helpful to add message such as "Expected <str1> to be {less
than, equals, greater than} <str2>, but it wasn't.
Where <str1/2> is the actual value, and the {less than, equals, greater than}
is determined by the expected result.
This way if the test fails you get a meaningful message and can see the values
that were compared.
Just a suggestion :)
Line 17: assertEquals(-Integer.signum(expectedResult),
Integer.signum(comparator.compare(str2, str1)));
Line 18: }
Line 19:
Line 20: @Test
--
To view, visit http://gerrit.ovirt.org/11996
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8c68446ea6f1865a51455a0a359df339bfb15bba
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches