@Test
public void identitySequenceTruncate() {

    AkibanInformationSchema ais = new AkibanInformationSchema();
    char[] chars = new char[DefaultNameGenerator.MAX_IDENT];
    Arrays.fill(chars, 'a');
    String maxIdent = new String(chars);
    // Table too long
    assertEquals(new TableName("test", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$1"),
                 generator.generateIdentitySequenceName(ais, new TableName("test", maxIdent), "s"));
    // Serial long
    assertEquals(new TableName("test", "t_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$1"),
                 generator.generateIdentitySequenceName(ais, new TableName("test", "t"), maxIdent));
    // Both long
    assertEquals(new TableName("test", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$1"),
                 generator.generateIdentitySequenceName(ais, new TableName("test", maxIdent), maxIdent));
    // Long with conflict
    Sequence.create(ais, "test", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$1", 1, 1, 1, 10, false);
    assertEquals(new TableName("test", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$2"),
                 generator.generateIdentitySequenceName(ais, new TableName("test", maxIdent), "s"));
}