@Test(expected = IllegalArgumentException.class)
 public void testLANG981() { // unmatched quote char in lexx
   DurationFormatUtils.lexx("'yMdHms''S");
 }
  @Test
  public void testLexx() {
    // tests each constant
    assertArrayEquals(
        new DurationFormatUtils.Token[] {
          new DurationFormatUtils.Token(DurationFormatUtils.y, 1),
          new DurationFormatUtils.Token(DurationFormatUtils.M, 1),
          new DurationFormatUtils.Token(DurationFormatUtils.d, 1),
          new DurationFormatUtils.Token(DurationFormatUtils.H, 1),
          new DurationFormatUtils.Token(DurationFormatUtils.m, 1),
          new DurationFormatUtils.Token(DurationFormatUtils.s, 1),
          new DurationFormatUtils.Token(DurationFormatUtils.S, 1)
        },
        DurationFormatUtils.lexx("yMdHmsS"));

    // tests the ISO8601-like
    assertArrayEquals(
        new DurationFormatUtils.Token[] {
          new DurationFormatUtils.Token(DurationFormatUtils.H, 1),
          new DurationFormatUtils.Token(new StringBuilder(":"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.m, 2),
          new DurationFormatUtils.Token(new StringBuilder(":"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.s, 2),
          new DurationFormatUtils.Token(new StringBuilder("."), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.S, 3)
        },
        DurationFormatUtils.lexx("H:mm:ss.SSS"));

    // test the iso extended format
    assertArrayEquals(
        new DurationFormatUtils.Token[] {
          new DurationFormatUtils.Token(new StringBuilder("P"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.y, 4),
          new DurationFormatUtils.Token(new StringBuilder("Y"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.M, 1),
          new DurationFormatUtils.Token(new StringBuilder("M"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.d, 1),
          new DurationFormatUtils.Token(new StringBuilder("DT"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.H, 1),
          new DurationFormatUtils.Token(new StringBuilder("H"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.m, 1),
          new DurationFormatUtils.Token(new StringBuilder("M"), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.s, 1),
          new DurationFormatUtils.Token(new StringBuilder("."), 1),
          new DurationFormatUtils.Token(DurationFormatUtils.S, 1),
          new DurationFormatUtils.Token(new StringBuilder("S"), 1)
        },
        DurationFormatUtils.lexx(DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN));

    // test failures in equals
    final DurationFormatUtils.Token token = new DurationFormatUtils.Token(DurationFormatUtils.y, 4);
    assertFalse("Token equal to non-Token class. ", token.equals(new Object()));
    assertFalse(
        "Token equal to Token with wrong value class. ",
        token.equals(new DurationFormatUtils.Token(new Object())));
    assertFalse(
        "Token equal to Token with different count. ",
        token.equals(new DurationFormatUtils.Token(DurationFormatUtils.y, 1)));
    final DurationFormatUtils.Token numToken = new DurationFormatUtils.Token(Integer.valueOf(1), 4);
    assertTrue("Token with Number value not equal to itself. ", numToken.equals(numToken));
  }