source: josm/trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTest.java@ 12545

Last change on this file since 12545 was 12545, checked in by Don-vip, 7 years ago

speed up TerritoriesTest

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import static org.junit.Assert.assertTrue;
5
6import org.junit.Rule;
7import org.junit.Test;
8import org.openstreetmap.josm.data.coor.LatLon;
9import org.openstreetmap.josm.testutils.JOSMTestRules;
10
11import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12import net.trajano.commons.testing.UtilityClassTestUtil;
13
14/**
15 * Unit tests of {@link Territories} class.
16 */
17public class TerritoriesTest {
18 /**
19 * Test rules.
20 */
21 @Rule
22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
23 public JOSMTestRules rules = new JOSMTestRules().platform().projection().territories();
24
25 /**
26 * Tests that {@code Territories} satisfies utility class criterias.
27 * @throws ReflectiveOperationException if an error occurs
28 */
29 @Test
30 public void testUtilityClass() throws ReflectiveOperationException {
31 UtilityClassTestUtil.assertUtilityClassWellDefined(Territories.class);
32 }
33
34 /**
35 * Test of {@link Territories#isIso3166Code} method.
36 */
37 @Test
38 public void testIsIso3166Code() {
39 check("Paris", new LatLon(48.8567, 2.3508), "EU", "FR", "FX");
40 }
41
42 private static void check(String name, LatLon ll, String ... expectedCodes) {
43 for (String e : expectedCodes) {
44 assertTrue(name + " " + e, Territories.isIso3166Code(e, ll));
45 }
46 }
47}
Note: See TracBrowser for help on using the repository browser.