Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
galen-core/src/test/java/com/galenframework/tests/speclang2/AlphanumericComparatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.galenframework.tests.speclang2; | ||
|
||
import com.galenframework.speclang2.AlphanumericComparator; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static java.util.Arrays.asList; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
public class AlphanumericComparatorTest { | ||
|
||
|
||
@Test | ||
public void shouldSortProperly() { | ||
List<String> list = asList( | ||
"abc 123 edf2", | ||
"abc 123 edf", | ||
"abc 2 edf", | ||
"abc 13 edf", | ||
"abc 12 edf", | ||
"abd 2 edf", | ||
"abb 2 edf" | ||
); | ||
|
||
Collections.sort(list, new AlphanumericComparator()); | ||
|
||
assertThat(list, is(asList( | ||
"abb 2 edf", | ||
"abc 2 edf", | ||
"abc 12 edf", | ||
"abc 13 edf", | ||
"abc 123 edf", | ||
"abc 123 edf2", | ||
"abd 2 edf" | ||
))); | ||
} | ||
} |