示例#1
0
  /** Test method for {@link net.sf.marineapi.nmea.parser.GLLParser#getPosition()}. */
  @Test
  public void testGetPosition() {
    final double lat = 60 + (11.552 / 60);
    final double lon = 25 + (1.941 / 60);

    Position p = instance.getPosition();
    assertNotNull(p);
    assertEquals(lat, p.getLatitude(), 0.0000001);
    assertEquals(lon, p.getLongitude(), 0.0000001);
    assertEquals(CompassPoint.NORTH, p.getLatitudeHemisphere());
    assertEquals(CompassPoint.EAST, p.getLongitudeHemisphere());
  }
示例#2
0
  /** Test method for {@link net.sf.marineapi.nmea.parser.GLLParser#setPosition(Position)}. */
  @Test
  public void testSetPositionWithZeroValues() {

    Position p1 = new Position(0.0, 0.0);
    instance.setPosition(p1);

    String s1 = instance.toString();
    Position p = instance.getPosition();

    assertTrue(s1.contains(",0000.000,N,"));
    assertTrue(s1.contains(",00000.000,E,"));
    assertNotNull(p);
    assertEquals(0.0, p.getLatitude(), 0.0000001);
    assertEquals(0.0, p.getLongitude(), 0.0000001);
  }
示例#3
0
  /** Test method for {@link net.sf.marineapi.nmea.parser.GLLParser#setPosition(Position)}. */
  @Test
  public void testSetPositionWithNonZeroValues() {

    final double lat = 60 + (11.552 / 60);
    final double lon = 25 + (1.941 / 60);
    Position p2 = new Position(lat, lon);
    instance.setPosition(p2);

    final String s2 = instance.toString();
    final Position p = instance.getPosition();

    assertTrue(s2.contains(",6011.552,N,"));
    assertTrue(s2.contains(",02501.941,E,"));
    assertNotNull(p);
    assertEquals(lat, p.getLatitude(), 0.0000001);
    assertEquals(lon, p.getLongitude(), 0.0000001);
  }