// CASE 1: INITIALLY DEFERRED
String content = "INITIALLY DEFERRED";
DdlTokenStream tokens = getTokens(content);
AstNode constraintNode = parser.nodeFactory().node("FK_1", rootNode, TYPE_TABLE_CONSTRAINT);
parser.parseConstraintAttributes(tokens, constraintNode);
assertEquals(1, constraintNode.getChildCount()); // ONE CHILD
List<AstNode> attributes = parser.nodeFactory().getChildrenForType(constraintNode, TYPE_CONSTRAINT_ATTRIBUTE);
assertEquals(1, attributes.size());
assertEquals(content, attributes.get(0).getProperty(PROPERTY_VALUE));
constraintNode.removeAllChildren();
// CASE 2: INITIALLY IMMEDIATE DEFERRABLE
content = "INITIALLY IMMEDIATE DEFERRABLE";
tokens = getTokens(content);
parser.parseConstraintAttributes(tokens, constraintNode);
assertEquals(2, constraintNode.getChildCount()); // TWO CHILDREN
attributes = parser.nodeFactory().getChildrenForType(constraintNode, TYPE_CONSTRAINT_ATTRIBUTE);
assertEquals(2, attributes.size());
assertEquals("INITIALLY IMMEDIATE", attributes.get(0).getProperty(PROPERTY_VALUE));
assertEquals("DEFERRABLE", attributes.get(1).getProperty(PROPERTY_VALUE));
constraintNode.removeAllChildren();
// CASE 3: NOT DEFERRABLE INITIALLY IMMEDIATE
content = "NOT DEFERRABLE INITIALLY IMMEDIATE";
tokens = getTokens(content);
parser.parseConstraintAttributes(tokens, constraintNode);
assertEquals(2, constraintNode.getChildCount()); // 2 Children
attributes = parser.nodeFactory().getChildrenForType(constraintNode, TYPE_CONSTRAINT_ATTRIBUTE);
assertEquals(2, attributes.size());
assertEquals("NOT DEFERRABLE", attributes.get(0).getProperty(PROPERTY_VALUE));
assertEquals("INITIALLY IMMEDIATE", attributes.get(1).getProperty(PROPERTY_VALUE));
constraintNode.removeAllChildren();
}