use of net.sf.marineapi.nmea.sentence.Sentence in project marine-api by ktuukkan.
the class SentenceFactoryTest method testRegisterParserWithAlternativeBeginChar.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.SentenceFactory#registerParser(java.lang.String, java.lang.Class)}
* .
*/
@Test
public void testRegisterParserWithAlternativeBeginChar() {
try {
instance.registerParser("VDM", VDMParser.class);
assertTrue(instance.hasParser("VDM"));
} catch (Exception e) {
fail("parser registering failed");
}
Sentence s = instance.createParser("!AIVDM,1,2,3");
assertNotNull(s);
assertTrue(s instanceof Sentence);
assertTrue(s instanceof SentenceParser);
assertTrue(s instanceof VDMParser);
instance.unregisterParser(VDMParser.class);
assertFalse(instance.hasParser("VDM"));
}
use of net.sf.marineapi.nmea.sentence.Sentence in project marine-api by ktuukkan.
the class SentenceFactoryTest method testCreateParser.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.SentenceFactory#createParser(java.lang.String)}
* .
*/
@Test
public void testCreateParser() {
Sentence bod = instance.createParser(BODTest.EXAMPLE);
assertNotNull(bod);
assertTrue(bod instanceof Sentence);
assertTrue(bod instanceof BODSentence);
assertTrue(bod instanceof BODParser);
assertEquals(BODTest.EXAMPLE, bod.toSentence());
}
use of net.sf.marineapi.nmea.sentence.Sentence in project marine-api by ktuukkan.
the class SentenceFactoryTest method testCreateEmptyParserWithSentenceIdStr.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.SentenceFactory#createParser(java.lang.String)}
* .
*/
@Test
public void testCreateEmptyParserWithSentenceIdStr() {
for (SentenceId id : SentenceId.values()) {
Sentence s = instance.createParser(TalkerId.II, id.name());
assertNotNull(s);
assertTrue(s instanceof Sentence);
assertTrue(s instanceof SentenceParser);
}
}
use of net.sf.marineapi.nmea.sentence.Sentence in project marine-api by ktuukkan.
the class SentenceParserTest method testConstructorForEmptySentence.
/**
* Test method for SenteceParser constructor.
*/
@Test
public void testConstructorForEmptySentence() {
Sentence s = new SentenceParser(TalkerId.GP, SentenceId.GLL, 5);
assertEquals("$GPGLL,,,,,*7C", s.toString());
}
use of net.sf.marineapi.nmea.sentence.Sentence in project marine-api by ktuukkan.
the class HeadingProviderTest method testHDMSentenceRead.
/**
* Test method for
* {@link net.sf.marineapi.provider.AbstractProvider#sentenceRead(net.sf.marineapi.nmea.event.SentenceEvent)}
* .
*/
@Test
public void testHDMSentenceRead() {
Sentence s = factory.createParser(HDMTest.EXAMPLE);
assertNull(event);
instance.sentenceRead(new SentenceEvent(this, s));
assertNotNull(event);
assertEquals(90.0, event.getHeading(), 0.1);
assertFalse(event.isTrue());
}
Aggregations