1 package org.simantics.utils.strings;
3 import java.util.Arrays;
8 public class TestAlphanumComparator {
16 "Allegia 6R Clasteron",
19 "Allegia 50B Clasteron",
20 "Allegia 50 Clasteron",
22 "Allegia 51 Clasteron",
24 "1000X Radonius Maximus",
26 "Allegia 500 Clasteron",
28 "Callisto Morphamax 600",
31 "Callisto Morphamax 500",
33 "Callisto Morphamax 6000 SE",
37 "Callisto Morphamax 6000 SE2",
38 "Callisto Morphamax 7000",
39 "Callisto Morphamax 700",
42 "Callisto Morphamax 5000",
55 "1000X Radonius Maximus",
56 "Allegia 6R Clasteron",
57 "Allegia 50 Clasteron",
58 "Allegia 50B Clasteron",
59 "Allegia 51 Clasteron",
60 "Allegia 500 Clasteron",
68 "Callisto Morphamax 500",
69 "Callisto Morphamax 600",
70 "Callisto Morphamax 700",
71 "Callisto Morphamax 5000",
72 "Callisto Morphamax 6000 SE",
73 "Callisto Morphamax 6000 SE2",
74 "Callisto Morphamax 7000",
87 public void testCaseSensitiveSort() {
88 Arrays.sort(test, AlphanumComparator.COMPARATOR);
89 for (int i = 0; i < test.length; ++i) {
90 if (!test[i].equals(expected[i])) {
91 throw new RuntimeException("Sorting did not match expected result:\n result: " + Arrays.toString(test) + "\n expected: " + Arrays.toString(expected));
97 "AlleGia 50 clAsTeron",
98 "ALLEgia 500 ClastERON",
99 "AlleGia 51 Clasteron",
100 "Allegia 6R CLASTERON",
101 "Allegia 50B Clasteron",
104 String[] expected2 = {
105 "Allegia 6R CLASTERON",
106 "AlleGia 50 clAsTeron",
107 "Allegia 50B Clasteron",
108 "AlleGia 51 Clasteron",
109 "ALLEgia 500 ClastERON",
113 public void testCaseInsensitiveSort() {
114 Arrays.sort(test2, AlphanumComparator.CASE_INSENSITIVE_COMPARATOR);
115 for (int i = 0; i < test2.length; ++i) {
116 if (!test2[i].equals(expected2[i])) {
117 throw new RuntimeException("Sorting did not match expected result:\n result: " + Arrays.toString(test2) + "\n expected: " + Arrays.toString(expected2));