Changeset 11404 in josm


Ignore:
Timestamp:
2016-12-15T21:34:01+01:00 (7 years ago)
Author:
Don-vip
Message:

replace groovy validator unit tests by java ones

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  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.tools
     2package org.openstreetmap.josm.tools;
    33
    4 class AlphanumComparatorTest extends GroovyTestCase {
     4import java.util.Arrays;
     5import java.util.Collections;
     6import java.util.List;
    57
    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")
     8import org.junit.Test;
     9
     10/**
     11 * Unit tests of {@link AlphanumComparator}.
     12 */
     13public 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");
    1023    }
    1124
    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");
    1633    }
    17 
    1834}
  • trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.java

    r11390 r11404  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.tools
     2package org.openstreetmap.josm.tools;
    33
    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
     4import static org.junit.Assert.assertEquals;
     5
     6import org.junit.Test;
     7
     8/**
     9 * Unit tests of {@link I18n}.
     10 */
     11public 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)));
    921    }
    1022}
Note: See TracChangeset for help on using the changeset viewer.