@Test
public void testColumnTrigger() throws Exception {

    PreparedStatement query = mock(PreparedStatement.class);
    given(getConnection().prepareStatement(anyString(), anyInt(), anyInt())).willReturn(query);
    String catalogName = null;
    String schemaName = "schema";
    String tableName = "table";
    String type = "TABLE";
    Table table = createTable(catalogName, schemaName, tableName);
    table.addColumn("f1");
    InspectionResults inspectionResults = new SimpleInspectionResults();
    ResultSet resultSet = mock(ResultSet.class);
    given(query.executeQuery()).willReturn(resultSet);
    given(resultSet.next()).willReturn(true, false);
    given(resultSet.getInt("TRIGGER_TYPE")).willReturn(1);
    given(resultSet.getInt("TYPE_MASK")).willReturn(1);
    given(resultSet.getInt("ACTIVE")).willReturn(1);
    given(resultSet.getString("TABLENAME")).willReturn(tableName);
    given(resultSet.getString("TRIGGER_TEXT")).willReturn("NEW.`f1` = 'NOW'; END_TRIGGER;");
    inspectionResults.addObject(table);
    TableInspectionScope inspectionScope = new TableInspectionScope(catalogName, schemaName, tableName);
    getInspectionManager().inspect(getConnection(), inspectionResults, inspectionScope, COLUMN_TRIGGER);
    verifyInspectScope(getInspector(), inspectionScope);
    Collection<ColumnTrigger> cTriggers = inspectionResults.getObjects(COLUMN_TRIGGER);
    assertEquals(cTriggers.size(), 1);
    ColumnTrigger columnTrigger = new ColumnTrigger();
    Column column = new Column("f1");
    columnTrigger.setColumn(column);
    columnTrigger.setTriggerEvent(TriggerEvent.valueOf("INSERT"));
    columnTrigger.setTriggerTime(TriggerTime.valueOf("BEFORE"));
    columnTrigger.setTriggerBody("NEW.`f1` = 'NOW'; END_TRIGGER");
    Table table1 = createTable(catalogName, schemaName, tableName);
    table1.addColumn(column);
    table1.setType(type);
    table1.addTrigger(columnTrigger);
    assertEquals(get(cTriggers, 0).getTriggerBody() + " END_TRIGGER",
            table1.getTriggers().iterator().next().getTriggerBody());
}