Ignore:
Timestamp:
2015-10-11T17:28:19+02:00 (6 years ago)
Author:
Don-vip
Message:

improve/cleanup unit tests

Location:
trunk/test/unit/org/openstreetmap/josm/gui/dialogs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/LatLonDialogTest.java

    r8540 r8857  
    22package org.openstreetmap.josm.gui.dialogs;
    33
    4 import static org.hamcrest.CoreMatchers.is;
    5 import static org.junit.Assert.assertThat;
     4import static org.junit.Assert.assertEquals;
    65
    76import org.junit.Test;
    87import org.openstreetmap.josm.data.coor.LatLon;
    98
     9/**
     10 * Unit tests of {@link LatLonDialog} class.
     11 */
    1012public class LatLonDialogTest {
     13
     14    /**
     15     * Unit test of {@link LatLonDialog#parseLatLon} method.
     16     */
    1117    @Test
    12     public void test1() throws Exception {
    13         assertThat(LatLonDialog.parseLatLon("49.29918° 19.24788°"), is(new LatLon(49.29918, 19.24788)));
    14     }
    15 
    16     @Test
    17     public void test2() throws Exception {
    18         assertThat(LatLonDialog.parseLatLon("N 49.29918 E 19.24788°"), is(new LatLon(49.29918, 19.24788)));
    19     }
    20 
    21     @Test
    22     public void test3() throws Exception {
    23         assertThat(LatLonDialog.parseLatLon("49.29918° 19.24788°"), is(new LatLon(49.29918, 19.24788)));
    24     }
    25 
    26     @Test
    27     public void test4() throws Exception {
    28         assertThat(LatLonDialog.parseLatLon("N 49.29918 E 19.24788"), is(new LatLon(49.29918, 19.24788)));
    29     }
    30 
    31     @Test
    32     public void test5() throws Exception {
    33         assertThat(LatLonDialog.parseLatLon("W 49°29.918' S 19°24.788'"), is(new LatLon(-19 - 24.788 / 60, -49 - 29.918 / 60)));
    34     }
    35 
    36     @Test
    37     public void test6() throws Exception {
    38         assertThat(LatLonDialog.parseLatLon("N 49°29'04\" E 19°24'43\""),
    39                 is(new LatLon(49 + 29. / 60 + 04. / 3600, 19 + 24. / 60 + 43. / 3600)));
    40     }
    41 
    42     @Test
    43     public void test7() throws Exception {
    44         assertThat(LatLonDialog.parseLatLon("49.29918 N, 19.24788 E"), is(new LatLon(49.29918, 19.24788)));
    45     }
    46 
    47     @Test
    48     public void test8() throws Exception {
    49         assertThat(LatLonDialog.parseLatLon("49°29'21\" N 19°24'38\" E"),
    50                 is(new LatLon(49 + 29. / 60 + 21. / 3600, 19 + 24. / 60 + 38. / 3600)));
    51     }
    52 
    53     @Test
    54     public void test9() throws Exception {
    55         assertThat(LatLonDialog.parseLatLon("49 29 51, 19 24 18"), is(new LatLon(49 + 29. / 60 + 51. / 3600, 19 + 24. / 60 + 18. / 3600)));
    56     }
    57 
    58     @Test
    59     public void test10() throws Exception {
    60         assertThat(LatLonDialog.parseLatLon("49 29, 19 24"), is(new LatLon(49 + 29. / 60, 19 + 24. / 60)));
    61     }
    62 
    63     @Test
    64     public void test11() throws Exception {
    65         assertThat(LatLonDialog.parseLatLon("E 49 29, N 19 24"), is(new LatLon(19 + 24. / 60, 49 + 29. / 60)));
    66     }
    67 
    68     @Test
    69     public void test12() throws Exception {
    70         assertThat(LatLonDialog.parseLatLon("49° 29; 19° 24"), is(new LatLon(49 + 29. / 60, 19 + 24. / 60)));
    71     }
    72 
    73     @Test
    74     public void test13() throws Exception {
    75         assertThat(LatLonDialog.parseLatLon("49° 29; 19° 24"), is(new LatLon(49 + 29. / 60, 19 + 24. / 60)));
    76     }
    77 
    78     @Test
    79     public void test14() throws Exception {
    80         assertThat(LatLonDialog.parseLatLon("N 49° 29, W 19° 24"), is(new LatLon(49 + 29. / 60, -19 - 24. / 60)));
    81     }
    82 
    83     @Test
    84     public void test15() throws Exception {
    85         assertThat(LatLonDialog.parseLatLon("49° 29.5 S, 19° 24.6 E"), is(new LatLon(-49 - 29.5 / 60, 19 + 24.6 / 60)));
    86     }
    87 
    88     @Test
    89     public void test16() throws Exception {
    90         assertThat(LatLonDialog.parseLatLon("N 49 29.918 E 19 15.88"), is(new LatLon(49 + 29.918 / 60, 19 + 15.88 / 60)));
    91     }
    92 
    93     @Test
    94     public void test17() throws Exception {
    95         assertThat(LatLonDialog.parseLatLon("49 29.4 19 24.5"), is(new LatLon(49 + 29.4 / 60, 19 + 24.5 / 60)));
    96     }
    97 
    98     @Test
    99     public void test18() throws Exception {
    100         assertThat(LatLonDialog.parseLatLon("-49 29.4 N -19 24.5 W"), is(new LatLon(-49 - 29.4 / 60, 19 + 24.5 / 60)));
     18    public void testparseLatLon() {
     19        assertEquals(new LatLon(49.29918, 19.24788), LatLonDialog.parseLatLon("49.29918° 19.24788°"));
     20        assertEquals(new LatLon(49.29918, 19.24788), LatLonDialog.parseLatLon("N 49.29918 E 19.24788°"));
     21        assertEquals(new LatLon(49.29918, 19.24788), LatLonDialog.parseLatLon("49.29918° 19.24788°"));
     22        assertEquals(new LatLon(49.29918, 19.24788), LatLonDialog.parseLatLon("N 49.29918 E 19.24788"));
     23        assertEquals(new LatLon(-19 - 24.788 / 60, -49 - 29.918 / 60), LatLonDialog.parseLatLon("W 49°29.918' S 19°24.788'"));
     24        assertEquals(new LatLon(49 + 29. / 60 + 04. / 3600, 19 + 24. / 60 + 43. / 3600), LatLonDialog.parseLatLon("N 49°29'04\" E 19°24'43\""));
     25        assertEquals(new LatLon(49.29918, 19.24788), LatLonDialog.parseLatLon("49.29918 N, 19.24788 E"));
     26        assertEquals(new LatLon(49 + 29. / 60 + 21. / 3600, 19 + 24. / 60 + 38. / 3600), LatLonDialog.parseLatLon("49°29'21\" N 19°24'38\" E"));
     27        assertEquals(new LatLon(49 + 29. / 60 + 51. / 3600, 19 + 24. / 60 + 18. / 3600), LatLonDialog.parseLatLon("49 29 51, 19 24 18"));
     28        assertEquals(new LatLon(49 + 29. / 60, 19 + 24. / 60), LatLonDialog.parseLatLon("49 29, 19 24"));
     29        assertEquals(new LatLon(19 + 24. / 60, 49 + 29. / 60), LatLonDialog.parseLatLon("E 49 29, N 19 24"));
     30        assertEquals(new LatLon(49 + 29. / 60, 19 + 24. / 60), LatLonDialog.parseLatLon("49° 29; 19° 24"));
     31        assertEquals(new LatLon(49 + 29. / 60, 19 + 24. / 60), LatLonDialog.parseLatLon("49° 29; 19° 24"));
     32        assertEquals(new LatLon(49 + 29. / 60, -19 - 24. / 60), LatLonDialog.parseLatLon("N 49° 29, W 19° 24"));
     33        assertEquals(new LatLon(-49 - 29.5 / 60, 19 + 24.6 / 60), LatLonDialog.parseLatLon("49° 29.5 S, 19° 24.6 E"));
     34        assertEquals(new LatLon(49 + 29.918 / 60, 19 + 15.88 / 60), LatLonDialog.parseLatLon("N 49 29.918 E 19 15.88"));
     35        assertEquals(new LatLon(49 + 29.4 / 60, 19 + 24.5 / 60), LatLonDialog.parseLatLon("49 29.4 19 24.5"));
     36        assertEquals(new LatLon(-49 - 29.4 / 60, 19 + 24.5 / 60), LatLonDialog.parseLatLon("-49 29.4 N -19 24.5 W"));
    10137    }
    10238}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java

    r8510 r8857  
    1919import org.openstreetmap.josm.io.OsmReader;
    2020
     21/**
     22 * Unit tests of {@link RelationSorter} class.
     23 */
    2124public class RelationSorterTest {
    2225
    23     private RelationSorter sorter = new RelationSorter();
     26    private final RelationSorter sorter = new RelationSorter();
    2427    private static DataSet testDataset;
    2528
     
    6972        Assert.assertArrayEquals(new String[]{"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4", "playground", "tree"}, actual);
    7073    }
    71 
    7274}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java

    r8836 r8857  
    1919import org.openstreetmap.josm.io.OsmReader;
    2020
     21/**
     22 * Unit tests of {@link WayConnectionTypeCalculator} class.
     23 */
    2124public class WayConnectionTypeCalculatorTest {
    2225
Note: See TracChangeset for help on using the changeset viewer.