@Test
public void createNode_CreateTableChange() throws Exception {
CreateTableChange change = new CreateTableChange();
change.setTableName("TABLE_NAME");
ColumnConfig column1 = new ColumnConfig();
column1.setName("id");
column1.setType("int");
ConstraintsConfig column1constraints = new ConstraintsConfig();
column1constraints.setPrimaryKey(true);
column1constraints.setNullable(false);
column1.setConstraints(column1constraints);
change.addColumn(column1);
ColumnConfig column2 = new ColumnConfig();
column2.setName("name");
column2.setType("varchar(255)");
change.addColumn(column2);
ColumnConfig column3 = new ColumnConfig();
column3.setName("state_id");
ConstraintsConfig column3constraints = new ConstraintsConfig();
column3constraints.setNullable(false);
column3constraints.setInitiallyDeferred(true);
column3constraints.setDeferrable(true);
column3constraints.setForeignKeyName("fk_tab_ref");
column3constraints.setReferences("state(id)");
column3.setConstraints(column3constraints);
change.addColumn(column3);
ColumnConfig column4 = new ColumnConfig();
column4.setName("phone");
column4.setType("varchar(255)");
column4.setDefaultValue("NOPHONE");
change.addColumn(column4);
ColumnConfig column5 = new ColumnConfig();
column5.setName("phone2");
column5.setType("varchar(255)");
ConstraintsConfig column5constraints = new ConstraintsConfig();
column5constraints.setUnique(true);
column5.setConstraints(column5constraints);
change.addColumn(column5);
Element element = new XMLChangeLogSerializer(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument()).createNode(change);
assertEquals("createTable", element.getTagName());
assertEquals(5, element.getChildNodes().getLength());