@Override @Test public void getConfirmationMessage() throws Exception { AddAutoIncrementChange change = new AddAutoIncrementChange(); change.setSchemaName("SCHEMA_NAME"); change.setTableName("TABLE_NAME"); change.setColumnName("COLUMN_NAME"); change.setColumnDataType("DATATYPE(255)"); assertEquals("Auto-increment added to TABLE_NAME.COLUMN_NAME", change.getConfirmationMessage()); }
@Override @Test public void generateStatement() throws Exception { AddAutoIncrementChange change = new AddAutoIncrementChange(); change.setSchemaName("SCHEMA_NAME"); change.setTableName("TABLE_NAME"); change.setColumnName("COLUMN_NAME"); change.setColumnDataType("DATATYPE(255)"); testChangeOnAllExcept( change, new GenerateAllValidator() { public void validate(SqlStatement[] sqlStatements, Database database) { assertEquals(1, sqlStatements.length); assertTrue(sqlStatements[0] instanceof AddAutoIncrementStatement); assertEquals( "SCHEMA_NAME", ((AddAutoIncrementStatement) sqlStatements[0]).getSchemaName()); assertEquals( "TABLE_NAME", ((AddAutoIncrementStatement) sqlStatements[0]).getTableName()); assertEquals( "COLUMN_NAME", ((AddAutoIncrementStatement) sqlStatements[0]).getColumnName()); assertEquals( "DATATYPE(255)", ((AddAutoIncrementStatement) sqlStatements[0]).getColumnDataType()); } }, PostgresDatabase.class); testChange( change, new GenerateAllValidator() { public void validate(SqlStatement[] sqlStatements, Database database) { assertEquals(3, sqlStatements.length); assertTrue(sqlStatements[0] instanceof CreateSequenceStatement); assertTrue(sqlStatements[1] instanceof SetNullableStatement); assertTrue(sqlStatements[2] instanceof AddDefaultValueStatement); } }, PostgresDatabase.class); }