Changeset 9436 in josm


Ignore:
Timestamp:
2016-01-13T23:58:45+01:00 (9 years ago)
Author:
Don-vip
Message:

increase test coverage

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

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java

    r9430 r9436  
    77import org.junit.Test;
    88import org.openstreetmap.josm.JOSMFixture;
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1011import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    2021    @BeforeClass
    2122    public static void setUpBeforeClass() {
    22         JOSMFixture.createUnitTestFixture().init();
     23        JOSMFixture.createUnitTestFixture().init(true);
     24    }
     25
     26    /**
     27     * Creates a new TMS layer.
     28     * @return a new TMS layer
     29     */
     30    public static TMSLayer createTmsLayer() {
     31        return new TMSLayer(new ImageryInfo("test tms", "http://localhost", "tms", null, null));
     32    }
     33
     34    /**
     35     * Creates a new Bing layer.
     36     * @return a new Bing layer
     37     */
     38    public static TMSLayer createBingLayer() {
     39        return new TMSLayer(new ImageryInfo("test bing", "http://localhost", "bing", null, null));
     40    }
     41
     42    /**
     43     * Creates a new Scanex layer.
     44     * @return a new Scanex layer
     45     */
     46    public static TMSLayer createScanexLayer() {
     47        return new TMSLayer(new ImageryInfo("test scanex", "http://localhost", "scanex", null, null));
     48    }
     49
     50    private static void test(ImageryType expected, TMSLayer layer) {
     51        Main.main.addLayer(layer);
     52        assertEquals(expected, layer.getInfo().getImageryType());
    2353    }
    2454
     
    2858    @Test
    2959    public void testTMSLayer() {
    30         TMSLayer tms = new TMSLayer(new ImageryInfo("test tms", "http://localhost", "tms", null, null));
    31         assertEquals(ImageryType.TMS, tms.getInfo().getImageryType());
    32 
    33         TMSLayer bing = new TMSLayer(new ImageryInfo("test bing", "http://localhost", "bing", null, null));
    34         assertEquals(ImageryType.BING, bing.getInfo().getImageryType());
    35 
    36         TMSLayer scanex = new TMSLayer(new ImageryInfo("test scanex", "http://localhost", "scanex", null, null));
    37         assertEquals(ImageryType.SCANEX, scanex.getInfo().getImageryType());
     60        test(ImageryType.TMS, createTmsLayer());
     61        test(ImageryType.BING, createBingLayer());
     62        test(ImageryType.SCANEX, createScanexLayer());
    3863    }
    3964}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

    r9430 r9436  
    77import org.junit.Test;
    88import org.openstreetmap.josm.JOSMFixture;
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1011import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    2021    @BeforeClass
    2122    public static void setUpBeforeClass() {
    22         JOSMFixture.createUnitTestFixture().init();
     23        JOSMFixture.createUnitTestFixture().init(true);
    2324    }
    2425
     
    2930    public void testWMSLayer() {
    3031        WMSLayer wms = new WMSLayer(new ImageryInfo("test wms", "http://localhost"));
     32        Main.main.addLayer(wms);
    3133        assertEquals(ImageryType.WMS, wms.getInfo().getImageryType());
    3234    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java

    r9430 r9436  
    2727     */
    2828    @Test
    29     public void testTMSLayer() {
     29    public void testWMTSLayer() {
    3030        WMTSLayer wmts = new WMTSLayer(new ImageryInfo("test wmts", "http://localhost", "wmts", null, null));
    3131        assertEquals(ImageryType.WMTS, wmts.getInfo().getImageryType());
Note: See TracChangeset for help on using the changeset viewer.