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