source: josm/trunk/test/unit/org/openstreetmap/josm/tools/GeoUrlToBoundsTest.java@ 12672

Last change on this file since 12672 was 10636, checked in by Don-vip, 8 years ago

see #13201 - checkstyle

File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import static org.hamcrest.CoreMatchers.nullValue;
5import static org.hamcrest.core.Is.is;
6import static org.junit.Assert.assertThat;
7
8import org.junit.Test;
9
10/**
11 * Unit tests of {@link GeoUrlToBoundsTest} class.
12 */
13public class GeoUrlToBoundsTest {
14
15 /**
16 * Tests parsing Geo URLs with the zoom specified.
17 */
18 @Test
19 public void testParse() {
20 assertThat(
21 GeoUrlToBounds.parse("geo:12.34,56.78?z=9"),
22 is(OsmUrlToBounds.positionToBounds(12.34, 56.78, 9))
23 );
24 }
25
26 /**
27 * Tests parsing Geo URLs without the zoom parameter.
28 */
29 @Test
30 public void testParseWithoutZoom() {
31 assertThat(
32 GeoUrlToBounds.parse("geo:12.34,56.78"),
33 is(OsmUrlToBounds.positionToBounds(12.34, 56.78, 18))
34 );
35 assertThat(
36 GeoUrlToBounds.parse("geo:-37.786971,-122.399677"),
37 is(OsmUrlToBounds.positionToBounds(-37.786971, -122.399677, 18))
38 );
39 }
40
41 /**
42 * Tests parsing invalid Geo URL.
43 */
44 @Test
45 public void testInvalid() {
46 assertThat(GeoUrlToBounds.parse("geo:foo"), nullValue());
47 assertThat(GeoUrlToBounds.parse("geo:foo,bar"), nullValue());
48 }
49
50 /**
51 * Tests parsing null.
52 */
53 @Test(expected = IllegalArgumentException.class)
54 public void testNull() {
55 GeoUrlToBounds.parse(null);
56 }
57}
Note: See TracBrowser for help on using the repository browser.