Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 | import static org.junit.jupiter.api.Assertions.assertThrows;
|
---|
6 |
|
---|
7 | import org.junit.jupiter.api.Test;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Unit tests of {@link RotationAngle} class.
|
---|
11 | */
|
---|
12 | class RotationAngleTest {
|
---|
13 |
|
---|
14 | private static final double EPSILON = 1e-11;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit test of method {@link RotationAngle#buildStaticRotation} - nominal cases.
|
---|
18 | */
|
---|
19 | @Test
|
---|
20 | void testParseCardinal() {
|
---|
21 | assertEquals(Math.PI, RotationAngle.buildStaticRotation("south").getRotationAngle(null), EPSILON);
|
---|
22 | assertEquals(Math.PI, RotationAngle.buildStaticRotation("s").getRotationAngle(null), EPSILON);
|
---|
23 | assertEquals(Math.toRadians(315), RotationAngle.buildStaticRotation("northwest").getRotationAngle(null), EPSILON);
|
---|
24 | }
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Unit test of method {@link RotationAngle#buildStaticRotation} - wrong parameter.
|
---|
28 | */
|
---|
29 | @Test
|
---|
30 | void testParseFail() {
|
---|
31 | assertThrows(IllegalArgumentException.class, () -> RotationAngle.buildStaticRotation("bad"));
|
---|
32 | }
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Unit test of method {@link RotationAngle#buildStaticRotation} - null handling.
|
---|
36 | */
|
---|
37 | @Test
|
---|
38 | void testParseNull() {
|
---|
39 | assertThrows(NullPointerException.class, () -> RotationAngle.buildStaticRotation(null));
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.