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

fix #19364 - Remote control /imagery: support all imagery options

File:
1 edited

Legend:

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

    r16588 r16589  
    22package org.openstreetmap.josm.io.remotecontrol.handler;
    33
     4import static org.hamcrest.CoreMatchers.hasItem;
    45import static org.junit.Assert.assertEquals;
     6import static org.junit.Assert.assertThat;
     7
     8import java.util.Arrays;
     9import java.util.List;
    510
    611import org.junit.Rule;
     
    8186
    8287    /**
     88     * Unit test for {@link ImageryHandler#getOptionalParams()}
     89     * @throws Exception if any error occurs
     90     */
     91    @Test
     92    public void testOptionalParams() throws Exception {
     93        List<String> optionalParams = Arrays.asList(newHandler("").getOptionalParams());
     94        assertThat(optionalParams, hasItem("type"));
     95        assertThat(optionalParams, hasItem("min-zoom"));
     96        assertThat(optionalParams, hasItem("max-zoom"));
     97        assertThat(optionalParams, hasItem("category"));
     98    }
     99
     100    /**
    83101     * Unit test for {@link ImageryHandler#buildImageryInfo()}
    84102     * @throws Exception if any error occurs
     
    87105    public void testBuildImageryInfo() throws Exception {
    88106        String url = "https://localhost/imagery?title=osm"
    89                 + "&type=tms&min_zoom=3&max_zoom=23"
     107                + "&type=tms&min_zoom=3&max_zoom=23&category=osmbasedmap&country_code=XA"
    90108                + "&url=https://a.tile.openstreetmap.org/%7Bzoom%7D/%7Bx%7D/%7By%7D.png";
    91109        ImageryInfo imageryInfo = newHandler(url).buildImageryInfo();
     
    95113        assertEquals(3, imageryInfo.getMinZoom());
    96114        assertEquals(23, imageryInfo.getMaxZoom());
     115        assertEquals(ImageryInfo.ImageryCategory.OSMBASEDMAP, imageryInfo.getImageryCategory());
     116        assertEquals("XA", imageryInfo.getCountryCode());
    97117    }
    98118}
Note: See TracChangeset for help on using the changeset viewer.