Changeset 11404 in josm for trunk/test/unit
- Timestamp:
- 2016-12-15T21:34:01+01:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/tools
- Files:
-
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/AlphanumComparatorTest.java
r11390 r11404 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.tools 2 package org.openstreetmap.josm.tools; 3 3 4 class AlphanumComparatorTest extends GroovyTestCase { 4 import java.util.Arrays; 5 import java.util.Collections; 6 import java.util.List; 5 7 6 void testNumeric() { 7 def lst = Arrays.asList("1", "20", "-1", "00999", "100") 8 Collections.sort(lst, AlphanumComparator.getInstance()) 9 assert lst == Arrays.asList("-1", "1", "20", "100", "00999") 8 import org.junit.Test; 9 10 /** 11 * Unit tests of {@link AlphanumComparator}. 12 */ 13 public class AlphanumComparatorTest { 14 15 /** 16 * Test numeric strings. 17 */ 18 @Test 19 public void testNumeric() { 20 List<String> lst = Arrays.asList("1", "20", "-1", "00999", "100"); 21 Collections.sort(lst, AlphanumComparator.getInstance()); 22 assert lst == Arrays.asList("-1", "1", "20", "100", "00999"); 10 23 } 11 24 12 void testMixed() { 13 def lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100") 14 Collections.sort(lst, AlphanumComparator.getInstance()) 15 assert lst == Arrays.asList("a5", "a100", "a00999", "b1", "b20") 25 /** 26 * Test mixed character strings. 27 */ 28 @Test 29 public void testMixed() { 30 List<String> lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100"); 31 Collections.sort(lst, AlphanumComparator.getInstance()); 32 assert lst == Arrays.asList("a5", "a100", "a00999", "b1", "b20"); 16 33 } 17 18 34 } -
trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.java
r11390 r11404 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.tools 2 package org.openstreetmap.josm.tools; 3 3 4 class I18nTest extends GroovyTestCase { 5 void testEscape() { 6 def foobar = "{foo'bar}" 7 assert I18n.escape(foobar) == "'{'foo''bar'}'" 8 assert I18n.tr(I18n.escape(foobar)) == foobar 4 import static org.junit.Assert.assertEquals; 5 6 import org.junit.Test; 7 8 /** 9 * Unit tests of {@link I18n}. 10 */ 11 public class I18nTest { 12 13 /** 14 * Unit test of {@link I18n#escape}. 15 */ 16 @Test 17 public void testEscape() { 18 String foobar = "{foo'bar}"; 19 assertEquals("'{'foo''bar'}'", I18n.escape(foobar)); 20 assertEquals(foobar, I18n.tr(I18n.escape(foobar))); 9 21 } 10 22 }
Note:
See TracChangeset
for help on using the changeset viewer.