source: josm/trunk/test/unit/org/openstreetmap/josm/tools/OverpassTurboQueryWizardTest.java@ 10956

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

fix #13079 - Use JOSMTestRules instead of JOSMFixture (tools tests, patch by michael2402) - gsoc-core

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import static org.junit.Assert.assertEquals;
5
6import org.junit.Rule;
7import org.junit.Test;
8import org.openstreetmap.josm.testutils.JOSMTestRules;
9
10import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
11
12/**
13 * Unit tests of {@link OverpassTurboQueryWizard} class.
14 */
15public class OverpassTurboQueryWizardTest {
16 /**
17 * Base test environment is enough
18 */
19 @Rule
20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
21 public JOSMTestRules test = new JOSMTestRules();
22
23 /**
24 * Test key=value.
25 */
26 @Test
27 public void testKeyValue() {
28 final String query = OverpassTurboQueryWizard.getInstance().constructQuery("amenity=drinking_water");
29 assertEquals("" +
30 "[out:xml][timeout:25];\n" +
31 "(\n" +
32 " node[\"amenity\"=\"drinking_water\"];\n" +
33 " way[\"amenity\"=\"drinking_water\"];\n" +
34 " relation[\"amenity\"=\"drinking_water\"];\n" +
35 ");\n" +
36 "(._;>;);\n" +
37 "out meta;", query);
38 }
39
40 /**
41 * Test erroneous value.
42 */
43 @Test(expected = UncheckedParseException.class)
44 public void testErroneous() {
45 OverpassTurboQueryWizard.getInstance().constructQuery("foo");
46 }
47}
Note: See TracBrowser for help on using the repository browser.