source: josm/trunk/test/unit/org/openstreetmap/josm/tools/RotationAngleTest.java@ 12802

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

see #14794 - checkstyle (unit tests)

  • Property svn:eol-style set to native
File size: 1.2 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.Test;
7
8/**
9 * Unit tests of {@link RotationAngle} class.
10 */
11public class RotationAngleTest {
12
13 private static final double EPSILON = 1e-11;
14
15 /**
16 * Unit test of method {@link RotationAngle#buildStaticRotation} - nominal cases.
17 */
18 @Test
19 public void testParseCardinal() {
20 assertEquals(Math.PI, RotationAngle.buildStaticRotation("south").getRotationAngle(null), EPSILON);
21 assertEquals(Math.PI, RotationAngle.buildStaticRotation("s").getRotationAngle(null), EPSILON);
22 assertEquals(Math.toRadians(315), RotationAngle.buildStaticRotation("northwest").getRotationAngle(null), EPSILON);
23 }
24
25 /**
26 * Unit test of method {@link RotationAngle#buildStaticRotation} - wrong parameter.
27 */
28 @Test(expected = IllegalArgumentException.class)
29 public void testParseFail() {
30 RotationAngle.buildStaticRotation("bad");
31 }
32
33 /**
34 * Unit test of method {@link RotationAngle#buildStaticRotation} - null handling.
35 */
36 @Test(expected = NullPointerException.class)
37 public void testParseNull() {
38 RotationAngle.buildStaticRotation(null);
39 }
40}
Note: See TracBrowser for help on using the repository browser.