source: josm/trunk/test/unit/org/openstreetmap/josm/tools/AlphanumComparatorTest.java@ 12548

Last change on this file since 12548 was 11405, checked in by Don-vip, 7 years ago

fix asserts

  • Property svn:eol-style set to native
File size: 961 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import static org.junit.Assert.assertEquals;
5
6import java.util.Arrays;
7import java.util.Collections;
8import java.util.List;
9
10import org.junit.Test;
11
12/**
13 * Unit tests of {@link AlphanumComparator}.
14 */
15public class AlphanumComparatorTest {
16
17 /**
18 * Test numeric strings.
19 */
20 @Test
21 public void testNumeric() {
22 List<String> lst = Arrays.asList("1", "20", "-1", "00999", "100");
23 Collections.sort(lst, AlphanumComparator.getInstance());
24 assertEquals(Arrays.asList("-1", "1", "20", "100", "00999"), lst);
25 }
26
27 /**
28 * Test mixed character strings.
29 */
30 @Test
31 public void testMixed() {
32 List<String> lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100");
33 Collections.sort(lst, AlphanumComparator.getInstance());
34 assertEquals(Arrays.asList("a5", "a100", "a00999", "b1", "b20"), lst);
35 }
36}
Note: See TracBrowser for help on using the repository browser.