+ ", PART_ID int NOT NULL DEFAULT (1000)"
+ ", FOREIGN KEY FK_SUPPLIER REFERENCES SUPPLIERS (SUPPLIER_ID, SUPPLIER_NAME) );";
DdlTokenStream tokens = getTokens(content);
AstNode tableNode = parser.nodeFactory().node("PART_COLOR", rootNode, TYPE_CREATE_TABLE_STATEMENT);
parser.parseColumnsAndConstraints(tokens, tableNode);
assertEquals(4, tableNode.getChildCount());
AstNode column = parser.nodeFactory().getChildforNameAndType(tableNode, "PART_COLOR", TYPE_COLUMN_DEFINITION);
assertNotNull(column);
assertEquals("VARCHAR", column.getProperty(DATATYPE_NAME).getFirstValue());
assertEquals(255, column.getProperty(DATATYPE_LENGTH).getFirstValue());
assertTrue(column.getProperty(DATATYPE_PRECISION) == null);
assertTrue(column.getProperty(DATATYPE_SCALE) == null);
assertEquals("NOT NULL", column.getProperty(NULLABLE).getFirstValue());
assertEquals(DEFAULT_ID_LITERAL, column.getProperty(DEFAULT_OPTION).getFirstValue());
assertEquals("BLUE", column.getProperty(DEFAULT_VALUE).getFirstValue());
AstNode foreignKeyNode = parser.nodeFactory().getChildforNameAndType(tableNode, "FK_SUPPLIER", TYPE_TABLE_CONSTRAINT);
assertEquals(DdlConstants.FOREIGN_KEY, foreignKeyNode.getProperty(CONSTRAINT_TYPE).getFirstValue());
assertEquals(3, foreignKeyNode.getChildCount()); // 2 COLUMN REFERENCES + 1 TABLE REFERENCE
}