@Test
public void shouldParseGrammarWithOptionalTokensAfterLength() {

    pattern = parser.parse(TYPE, "INTEGER[(L)] [UNSIGNED]");
    assertThat(pattern).isNotNull();
    type = pattern.match(text("INTEGER"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("INTEGER");
    assertThat(type.expression()).isEqualTo("INTEGER");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("INTEGER(3)"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(3);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("INTEGER");
    assertThat(type.expression()).isEqualTo("INTEGER(3)");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("INTEGER UNSIGNED"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("INTEGER UNSIGNED");
    assertThat(type.expression()).isEqualTo("INTEGER UNSIGNED");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("INTEGER(3) UNSIGNED"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(3);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("INTEGER UNSIGNED");
    assertThat(type.expression()).isEqualTo("INTEGER(3) UNSIGNED");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
}