Added test.

This commit is contained in:
Diederik Muylwyk 2019-10-08 13:19:35 -04:00
parent 175c0781eb
commit 23264f497f
1 changed files with 21 additions and 0 deletions

View File

@ -9,7 +9,28 @@ import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class ModifyColumnTest extends BaseTest { public class ModifyColumnTest extends BaseTest {
@Test
public void testColumnWithJdbcTypeClob() throws SQLException {
executeSql("create table SOMETABLE (TEXTCOL varchar2(255 char), TEXTCOL2 clob)");
ModifyColumnTask task = new ModifyColumnTask();
task.setTableName("SOMETABLE");
task.setColumnName("TEXTCOL");
task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING);
task.setNullable(true);
task.setColumnLength(250);
getMigrator().addTask(task);
getMigrator().migrate();
assertEquals(new JdbcUtils.ColumnType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 250), JdbcUtils.getColumnType(getConnectionProperties(), "SOMETABLE", "TEXTCOL"));
assertEquals(1, task.getExecutedStatements().size());
// Make sure additional migrations don't crash
getMigrator().migrate();
getMigrator().migrate();
}
@Test @Test
public void testColumnAlreadyExists() throws SQLException { public void testColumnAlreadyExists() throws SQLException {