1 |
|
package liquibase.change.core; |
2 |
|
|
3 |
|
import liquibase.change.AbstractChangeTest; |
4 |
|
import liquibase.database.Database; |
5 |
|
import liquibase.database.core.MockDatabase; |
6 |
|
import liquibase.database.core.SQLiteDatabase; |
7 |
|
import liquibase.statement.SqlStatement; |
8 |
|
import liquibase.statement.core.DropDefaultValueStatement; |
9 |
|
import static org.junit.Assert.*; |
10 |
|
import org.junit.Test; |
11 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 4 |
Complexity Density: 0.25 |
|
12 |
|
public class DropDefaultValueChangeTest extends AbstractChangeTest { |
13 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
14 |
1
|
@Override... |
15 |
|
@Test |
16 |
|
public void getRefactoringName() throws Exception { |
17 |
1
|
assertEquals("Drop Default Value", new DropDefaultValueChange().getChangeMetaData().getDescription()); |
18 |
|
} |
19 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1
PASS
|
|
20 |
1
|
@Override... |
21 |
|
@Test |
22 |
|
public void generateStatement() throws Exception { |
23 |
1
|
DropDefaultValueChange change = new DropDefaultValueChange(); |
24 |
1
|
change.setSchemaName("SCHEMA_NAME"); |
25 |
1
|
change.setTableName("TABLE_NAME"); |
26 |
1
|
change.setColumnName("COL_HERE"); |
27 |
|
|
28 |
1
|
SqlStatement[] sqlStatements = change.generateStatements(new MockDatabase()); |
29 |
1
|
assertEquals(1, sqlStatements.length); |
30 |
1
|
assertTrue(sqlStatements[0] instanceof DropDefaultValueStatement); |
31 |
1
|
assertEquals("SCHEMA_NAME", ((DropDefaultValueStatement) sqlStatements[0]).getSchemaName()); |
32 |
1
|
assertEquals("TABLE_NAME", ((DropDefaultValueStatement) sqlStatements[0]).getTableName()); |
33 |
1
|
assertEquals("COL_HERE", ((DropDefaultValueStatement) sqlStatements[0]).getColumnName()); |
34 |
|
} |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
36 |
1
|
@Override... |
37 |
|
@Test |
38 |
|
public void getConfirmationMessage() throws Exception { |
39 |
1
|
DropDefaultValueChange change = new DropDefaultValueChange(); |
40 |
1
|
change.setTableName("TABLE_NAME"); |
41 |
1
|
change.setColumnName("COL_HERE"); |
42 |
|
|
43 |
1
|
assertEquals("Default value dropped from TABLE_NAME.COL_HERE", change.getConfirmationMessage()); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
15
|
@Override... |
47 |
|
protected boolean changeIsUnsupported(Database database) { |
48 |
15
|
return database instanceof SQLiteDatabase; |
49 |
|
} |
50 |
|
|
51 |
|
} |