source: josm/trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTestIT.java @ 12444

Last change on this file since 12444 was 12444, checked in by Don-vip, 5 months ago

refactor WMS test to integration test as it relies on external WMS server

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.junit.Assert.assertEquals;
5
6import java.util.List;
7
8import org.junit.Rule;
9import org.junit.Test;
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.data.imagery.ImageryInfo;
12import org.openstreetmap.josm.gui.layer.WMSLayer;
13import org.openstreetmap.josm.testutils.JOSMTestRules;
14
15import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
16
17/**
18 * Unit tests for class {@link AddImageryLayerAction}.
19 */
20public final class AddImageryLayerActionTestIT {
21    /**
22     * We need prefs for this. We need platform for actions and the OSM API for checking blacklist.
23     * The timeout is set to default httpclient read timeout + connect timeout + a small delay to ignore
24     * common but harmless network issues.
25     */
26    @Rule
27    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
28    public JOSMTestRules test = new JOSMTestRules().preferences().platform().fakeAPI().timeout(45500);
29
30    /**
31     * Integration test of {@link AddImageryLayerAction#actionPerformed} - Enabled cases for WMS.
32     */
33    @Test
34    public void testActionPerformedEnabledWms() {
35        new AddImageryLayerAction(new ImageryInfo("wms.openstreetmap.fr", "http://wms.openstreetmap.fr/wms?",
36                "wms_endpoint", null, null)).actionPerformed(null);
37        List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class);
38        assertEquals(1, wmsLayers.size());
39
40        Main.getLayerManager().removeLayer(wmsLayers.get(0));
41    }
42}
Note: See TracBrowser for help on using the repository browser.