Skip to content

Commit

Permalink
Merge pull request #19 from mikegolod/create_trigger_fixes
Browse files Browse the repository at this point in the history
CreateTriggerTest fixes & refactoring
  • Loading branch information
nvoxland committed Mar 15, 2016
2 parents e26f345 + 7b63b8e commit a480e97
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void setProcedure(String procedure) {
}

public String getConfirmationMessage() {
return "Trigger" + getTriggerName() + " has been created";
return "Trigger " + getTriggerName() + " has been created";
}

protected Change[] createInverses() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ public void setUp() throws Exception {

@Test
public void getChangeMetaData() {
CreateTriggerChange addPrimaryKeyChange = new CreateTriggerChange();
CreateTriggerChange createTriggerChange = new CreateTriggerChange();

assertEquals("createTrigger", ChangeFactory.getInstance().getChangeMetaData(addPrimaryKeyChange).getName());
assertEquals("Create Trigger", ChangeFactory.getInstance().getChangeMetaData(addPrimaryKeyChange).getDescription());
assertEquals(ChangeMetaData.PRIORITY_DEFAULT, ChangeFactory.getInstance().getChangeMetaData(addPrimaryKeyChange).getPriority());
assertEquals("createTrigger", ChangeFactory.getInstance().getChangeMetaData(createTriggerChange).getName());
assertEquals("Create Trigger", ChangeFactory.getInstance().getChangeMetaData(createTriggerChange).getDescription());
assertEquals(ChangeMetaData.PRIORITY_DEFAULT, ChangeFactory.getInstance().getChangeMetaData(createTriggerChange).getPriority());
}

@Test
public void getConfirmationMessage() {
CreateTriggerChange change = new CreateTriggerChange();
change.setTriggerName("TRIGGER_NAME");

assertEquals("Trigger TRIGGER_NAME has been created", "Trigger " + change.getTriggerName() + " has been created");
assertEquals("Trigger TRIGGER_NAME has been created", change.getConfirmationMessage());
}

@Test
Expand Down Expand Up @@ -81,23 +81,24 @@ public void generateStatement() {
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof CreateTriggerStatement);

assertEquals("SCHEMA_NAME", ((CreateTriggerStatement) sqlStatements[0]).getSchemaName());
assertEquals("TABLE_NAME", ((CreateTriggerStatement) sqlStatements[0]).getTableName());
assertEquals("COLUMN_NAMES", ((CreateTriggerStatement) sqlStatements[0]).getColumnNames());
assertEquals("TABLESPACE_NAME", ((CreateTriggerStatement) sqlStatements[0]).getTablespace());
assertEquals("AFTER_BEFORE_INSTEADOF", ((CreateTriggerStatement) sqlStatements[0]).getAfterBeforeInsteadOf());
assertEquals("NESTED_TABLE_COLUMN", ((CreateTriggerStatement) sqlStatements[0]).getNestedTableColumn());
assertEquals("POCEDURE", ((CreateTriggerStatement) sqlStatements[0]).getProcedure());
assertEquals("TRIGGER_NAME", ((CreateTriggerStatement) sqlStatements[0]).getTriggerName());
assertEquals("VIEW_NAME", ((CreateTriggerStatement) sqlStatements[0]).getViewName());
assertEquals("WHEN_CONDITION", ((CreateTriggerStatement) sqlStatements[0]).getWhenCondition());

assertTrue(((CreateTriggerStatement) sqlStatements[0]).getUpdate());
assertTrue(((CreateTriggerStatement) sqlStatements[0]).getUpdateOf());
assertTrue(((CreateTriggerStatement) sqlStatements[0]).getReplace());
assertTrue(((CreateTriggerStatement) sqlStatements[0]).getDelete());
assertTrue(((CreateTriggerStatement) sqlStatements[0]).getForEachRow());
assertTrue(((CreateTriggerStatement) sqlStatements[0]).getInsert());
CreateTriggerStatement sqlStatement = (CreateTriggerStatement) sqlStatements[0];
assertEquals("SCHEMA_NAME", sqlStatement.getSchemaName());
assertEquals("TABLE_NAME", sqlStatement.getTableName());
assertEquals("COLUMN_NAMES", sqlStatement.getColumnNames());
assertEquals("TABLESPACE_NAME", sqlStatement.getTablespace());
assertEquals("AFTER_BEFORE_INSTEADOF", sqlStatement.getAfterBeforeInsteadOf());
assertEquals("NESTED_TABLE_COLUMN", sqlStatement.getNestedTableColumn());
assertEquals("POCEDURE", sqlStatement.getProcedure());
assertEquals("TRIGGER_NAME", sqlStatement.getTriggerName());
assertEquals("VIEW_NAME", sqlStatement.getViewName());
assertEquals("WHEN_CONDITION", sqlStatement.getWhenCondition());

assertTrue(sqlStatement.getUpdate());
assertTrue(sqlStatement.getUpdateOf());
assertTrue(sqlStatement.getReplace());
assertTrue(sqlStatement.getDelete());
assertTrue(sqlStatement.getForEachRow());
assertTrue(sqlStatement.getInsert());
}

@Test
Expand Down

0 comments on commit a480e97

Please sign in to comment.