Clover Coverage Report - Liquibase Core 2.0.3-SNAPSHOT
Coverage timestamp: Sat Aug 6 2011 11:33:15 EDT
16   51   4   4
0   42   0.25   4
4     1  
1    
 
  DropDefaultValueChangeTest       Line # 12 16 0% 4 0 100% 1.0
 
  (4)
 
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   
 
12    public class DropDefaultValueChangeTest extends AbstractChangeTest {
13   
 
14  1 toggle @Override
15    @Test
16    public void getRefactoringName() throws Exception {
17  1 assertEquals("Drop Default Value", new DropDefaultValueChange().getChangeMetaData().getDescription());
18    }
19   
 
20  1 toggle @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   
 
36  1 toggle @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   
 
46  15 toggle @Override
47    protected boolean changeIsUnsupported(Database database) {
48  15 return database instanceof SQLiteDatabase;
49    }
50   
51    }