@Test public void testDMS() throws CoordinateFormatException { createLatitudeEditor(); Assert.assertEquals(25.18173056, editor.parse("25 10 54.23\" N"), DELTA); Assert.assertEquals(-176.8397222, editor.parse("176 50' 23\" S"), DELTA); }
@Test public void formatDDd() { createLatitudeEditor(); editor.setNotation(CoordinateParser.Notation.DDd); Assert.assertEquals("+2.405000", editor.format(2.405)); }
@Test public void testDMd() throws CoordinateFormatException { createLatitudeEditor(); Assert.assertEquals(30.25, editor.parse("30 15.00\" N"), DELTA); Assert.assertEquals(-30.75, editor.parse("30 45.0000\" S"), DELTA); Assert.assertEquals(-25.25, editor.parse("S 25 15 "), DELTA); }
@Test public void testDDdParse() throws CoordinateFormatException { createLatitudeEditor(); Assert.assertEquals(6.325, editor.parse("+6.325"), DELTA); Assert.assertEquals(-6.325, editor.parse("6.325 S"), DELTA); Assert.assertEquals(-2.45, editor.parse("S 2.45"), DELTA); Assert.assertEquals(+2.0, editor.parse("2N"), DELTA); }
public void testNoHemiOK() throws CoordinateFormatException { createLongitudeEditor(); editor.setMinValue(-20); editor.setMaxValue(-21); Assert.assertEquals(-20.5, editor.parse("20.5"), 0.001); editor.setMinValue(30); editor.setMaxValue(35); Assert.assertEquals(33.3, editor.parse("33.3"), 0.001); }
@Test(expected = CoordinateFormatException.class) public void testNoHemiError() throws CoordinateFormatException { createLatitudeEditor(); editor.parse("2.345"); }
@Test public void testNearEquator() { createLatitudeEditor(); Assert.assertEquals(editor.format(-0.9392889738082886), "0° 56' 21.44\" S"); }