source: josm/trunk/test/unit/org/openstreetmap/josm/io/CapabilitiesTest.java@ 17212

Last change on this file since 17212 was 17212, checked in by simon04, 4 years ago

Fix CapabilitiesTest

File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertTrue;
6
7import java.io.InputStream;
8import java.nio.file.Files;
9import java.nio.file.Path;
10import java.nio.file.Paths;
11import java.util.Collections;
12
13import org.junit.Test;
14import org.openstreetmap.josm.TestUtils;
15import org.xml.sax.InputSource;
16
17/**
18 * Unit tests of {@link Capabilities} class.
19 */
20public class CapabilitiesTest {
21
22 /**
23 * Unit test of {@link Capabilities}
24 *
25 * @throws Exception if any error occurs
26 */
27 @Test
28 public void testCapabilities() throws Exception {
29 final Path path = Paths.get(TestUtils.getTestDataRoot(), "__files/api/0.6/capabilities");
30 final Capabilities capabilities;
31 try (InputStream inputStream = Files.newInputStream(path)) {
32 capabilities = Capabilities.CapabilitiesParser.parse(new InputSource(inputStream));
33 }
34 assertEquals(10000, capabilities.getMaxChangesetSize());
35 assertEquals(2000, capabilities.getMaxWayNodes());
36 assertTrue(capabilities.isOnImageryBlacklist("http://mt0.google.com/vt/lyrs=p&hl=en&x={x}&y={y}&z={z}"));
37 assertEquals(Collections.singletonList(".*\\.google(apis)?\\..*/(vt|kh)[\\?/].*([xyz]=.*){3}.*"), capabilities.getImageryBlacklist());
38 }
39}
Note: See TracBrowser for help on using the repository browser.