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

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

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • 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.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertThrows;
6
7import org.junit.jupiter.api.Test;
8
9/**
10 * Unit tests of {@link RotationAngle} class.
11 */
12class 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.