/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package routegui; import java.io.IOException; import org.junit.Test; import static org.junit.Assert.*; import static java.util.Calendar.*; /** * * @author rick */ public class GPRMCTest { @Test public void GPRMCTest() { /* Data entry check HHMMSS.XXX*/ GPRMC entry = new GPRMC("$GPRMC,080756.00,A,5159.38233,N,00422.72435,E,0.011,,120308,,,A*76"); assertEquals(2008, entry.calendar.get(YEAR)); assertEquals(03, entry.calendar.get(MONTH)); assertEquals(12, entry.calendar.get(DAY_OF_MONTH)); assertEquals(8, entry.calendar.get(HOUR)); assertEquals(7, entry.calendar.get(MINUTE)); assertEquals(56, entry.calendar.get(SECOND)); assertEquals(00, entry.calendar.get(MILLISECOND)); assertEquals(51.9897055, entry.position.getLatitude()); assertEquals(4.378739166666667, entry.position.getLongitude()); assertEquals(true, entry.sateliteFixStatus); assertEquals(0.011, entry.speed); /* Checksum check, should fail */ boolean result = entry.process("$GPRMC,080756.00,A,5159.38233,N,00422.72435,E,0.011,,120308,,,A*75"); assertEquals(false, result); } }