Example #1
0
 /** Test method for SenteceParser constructor. */
 @Test
 public void testConstructorWithAIVDM() {
   Sentence s = new SentenceParser(VDM_EXAMPLE);
   assertTrue(s.isValid());
   assertFalse(s.isProprietary());
   assertEquals(Sentence.ALTERNATIVE_BEGIN_CHAR, s.getBeginChar());
   assertEquals(VDM_EXAMPLE, s.toString());
 }
Example #2
0
  /** Test method for SentenceParser constructors called from derived custom parsers. */
  @Test
  public void testConstructorWithCustomParser() {

    final String foo = "FOO";
    SentenceFactory sf = SentenceFactory.getInstance();
    sf.registerParser(foo, FOOParser.class);

    final String fooSentence = "$GPFOO,B,A,R";
    final FOOParser fp = new FOOParser(fooSentence);
    final Sentence s = sf.createParser(fooSentence);

    assertTrue(s instanceof SentenceParser);
    assertTrue(s instanceof FOOParser);
    assertEquals(foo, s.getSentenceId());
    assertEquals(TalkerId.GP, s.getTalkerId());
    assertEquals(s, fp);
  }
Example #3
0
 /** Test method for SenteceParser constructor. */
 @Test
 public void testConstructorForEmptySentence() {
   Sentence s = new SentenceParser(TalkerId.GP, SentenceId.GLL, 5);
   assertEquals("$GPGLL,,,,,*7C", s.toString());
 }