// CASE 1
String content = "PARTID VARCHAR (255) NOT NULL DEFAULT '12345'";
DdlTokenStream tokens = getTokens(content);
AstNode tableNode = parser.nodeFactory().node("PARTID", rootNode, TYPE_CREATE_TABLE_STATEMENT, rootNode);
parser.setRootNode(rootNode);
parser.parseColumnDefinition(tokens, tableNode, false);
assertEquals(1, tableNode.getChildCount());
AstNode column = tableNode.getChildren().get(0);
assertEquals("VARCHAR", column.getProperty(DATATYPE_NAME).getFirstValue());
assertEquals(255, column.getProperty(DATATYPE_LENGTH).getFirstValue());
assertTrue(column.getProperty(DATATYPE_PRECISION) == null);
assertEquals("NOT NULL", column.getProperty(NULLABLE).getFirstValue());
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION).getFirstValue());
assertEquals("'12345'", column.getProperty(DEFAULT_VALUE).getFirstValue());
tableNode.removeAllChildren();
// CASE 2
content = "PARTID CHARACTER (255) NULL DEFAULT (12345)";
tokens = getTokens(content);
parser.parseColumnDefinition(tokens, tableNode, false);
assertEquals(1, tableNode.getChildCount());
column = tableNode.getChildren().get(0);
assertEquals("CHARACTER", column.getProperty(DATATYPE_NAME).getFirstValue());
assertEquals(255, column.getProperty(DATATYPE_LENGTH).getFirstValue());
assertTrue(column.getProperty(DATATYPE_PRECISION) == null);
assertEquals("NULL", column.getProperty(NULLABLE).getFirstValue());
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION).getFirstValue());
assertEquals("12345", column.getProperty(DEFAULT_VALUE).getFirstValue());
tableNode.removeAllChildren();
// CASE 3
content = "PARTID DECIMAL (6, 2) DEFAULT (6.213)";
tokens = getTokens(content);
parser.parseColumnDefinition(tokens, tableNode, false);
assertEquals(1, tableNode.getChildCount());
column = tableNode.getChildren().get(0);
assertEquals("DECIMAL", column.getProperty(DATATYPE_NAME).getFirstValue());
assertEquals(6, column.getProperty(DATATYPE_PRECISION).getFirstValue());
assertEquals(2, column.getProperty(DATATYPE_SCALE).getFirstValue());
assertTrue(column.getProperty(DATATYPE_LENGTH) == null);
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION).getFirstValue());
assertEquals("6.213", column.getProperty(DEFAULT_VALUE).getFirstValue());
}