Changeset 7079 in josm for trunk/test


Ignore:
Timestamp:
2014-05-08T15:15:11+02:00 (10 years ago)
Author:
Don-vip
Message:

fix some unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerHistoryReaderTest.java

    r7040 r7079  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.io;
     3
     4import static org.junit.Assert.assertTrue;
    35
    46import org.junit.BeforeClass;
     
    1012import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    1113
     14/**
     15 * History fetching tests. This test operates with production API.
     16 */
    1217public class OsmServerHistoryReaderTest {
    1318
     19    /**
     20     * Setup tests.
     21     */
    1422    @BeforeClass
    1523    public static void init() {
    16         System.setProperty("josm.home", "C:\\data\\projekte\\osm\\tag-editor-plugin");
    17         Main.pref.init(false);
     24        Main.initApplicationPreferences();
     25        Main.pref.put("osm-server.url", OsmApi.DEFAULT_API_URL);
    1826    }
    1927
     28    /**
     29     * Tests node history fetching.
     30     * @throws OsmTransferException if any error occurs
     31     */
    2032    @Test
    21     public void testNode()  throws OsmTransferException {
    22         OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.NODE,266187);
     33    public void testNode() throws OsmTransferException {
     34        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.NODE, 266187);
    2335        HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
    2436        History h = ds.getHistory(266187, OsmPrimitiveType.NODE);
    25         System.out.println("num versions: " + h.getNumVersions());
     37        assertTrue("NumVersions", h.getNumVersions() >= 4);
    2638    }
    2739
     40    /**
     41     * Tests way history fetching.
     42     * @throws OsmTransferException if any error occurs
     43     */
    2844    @Test
    29     public void testWay()  throws OsmTransferException {
    30         OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.WAY,3058844);
     45    public void testWay() throws OsmTransferException {
     46        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.WAY, 3058844);
    3147        HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
    3248        History h = ds.getHistory(3058844, OsmPrimitiveType.WAY);
    33         System.out.println("num versions: " + h.getNumVersions());
     49        assertTrue("NumVersions", h.getNumVersions() >= 13);
    3450    }
    3551
     52    /**
     53     * Tests relation history fetching.
     54     * @throws OsmTransferException if any error occurs
     55     */
    3656    @Test
    37     public void testRelation()  throws OsmTransferException {
    38         OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.RELATION,49);
     57    public void testRelation() throws OsmTransferException {
     58        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.RELATION, 49);
    3959        HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
    4060        History h = ds.getHistory(49, OsmPrimitiveType.RELATION);
    41         System.out.println("num versions: " + h.getNumVersions());
     61        assertTrue("NumVersions", h.getNumVersions() >= 3);
    4262    }
    4363}
Note: See TracChangeset for help on using the changeset viewer.