1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.layer;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 |
|
---|
6 | import org.junit.BeforeClass;
|
---|
7 | import org.junit.Test;
|
---|
8 | import org.openstreetmap.josm.JOSMFixture;
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.data.imagery.ImageryInfo;
|
---|
11 | import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Unit tests of {@link WMSLayer} class.
|
---|
15 | */
|
---|
16 | public class WMSLayerTest {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Setup tests
|
---|
20 | */
|
---|
21 | @BeforeClass
|
---|
22 | public static void setUpBeforeClass() {
|
---|
23 | JOSMFixture.createUnitTestFixture().init(true);
|
---|
24 | }
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Unit test of {@link WMSLayer#WMSLayer}.
|
---|
28 | */
|
---|
29 | @Test
|
---|
30 | public void testWMSLayer() {
|
---|
31 | WMSLayer wms = new WMSLayer(new ImageryInfo("test wms", "http://localhost"));
|
---|
32 | Main.getLayerManager().addLayer(wms);
|
---|
33 | try {
|
---|
34 | assertEquals(ImageryType.WMS, wms.getInfo().getImageryType());
|
---|
35 | } finally {
|
---|
36 | // Ensure we clean the place before leaving, even if test fails.
|
---|
37 | Main.getLayerManager().removeLayer(wms);
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13828">Bug #13828</a>.
|
---|
43 | */
|
---|
44 | @Test(expected = IllegalArgumentException.class)
|
---|
45 | public void testTicket13828() {
|
---|
46 | new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"));
|
---|
47 | }
|
---|
48 | }
|
---|