Changeset 16588 in josm for trunk/test/unit


Ignore:
Timestamp:
2020-06-09T23:44:53+02:00 (4 years ago)
Author:
simon04
Message:

Add ImageryHandlerTest.testBuildImageryInfo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java

    r14138 r16588  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.io.remotecontrol.handler;
     3
     4import static org.junit.Assert.assertEquals;
    35
    46import org.junit.Rule;
    57import org.junit.Test;
    68import org.junit.rules.ExpectedException;
     9import org.openstreetmap.josm.data.imagery.ImageryInfo;
    710import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    811import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    7679        newHandler("https://localhost?url=foo").handle();
    7780    }
     81
     82    /**
     83     * Unit test for {@link ImageryHandler#buildImageryInfo()}
     84     * @throws Exception if any error occurs
     85     */
     86    @Test
     87    public void testBuildImageryInfo() throws Exception {
     88        String url = "https://localhost/imagery?title=osm"
     89                + "&type=tms&min_zoom=3&max_zoom=23"
     90                + "&url=https://a.tile.openstreetmap.org/%7Bzoom%7D/%7Bx%7D/%7By%7D.png";
     91        ImageryInfo imageryInfo = newHandler(url).buildImageryInfo();
     92        assertEquals("osm", imageryInfo.getName());
     93        assertEquals(ImageryInfo.ImageryType.TMS, imageryInfo.getImageryType());
     94        assertEquals("https://a.tile.openstreetmap.org/{zoom}/{x}/{y}.png", imageryInfo.getUrl());
     95        assertEquals(3, imageryInfo.getMinZoom());
     96        assertEquals(23, imageryInfo.getMaxZoom());
     97    }
    7898}
Note: See TracChangeset for help on using the changeset viewer.