/** * Given a name of a non-existing table to drop. <br> * When StagingTransformGenerator is called to drop this table, then it shouldn't execute drop * statement. */ @Test public void shouldNotDropTableIfNotExists() throws Exception { String nonExistingTable = "nonExistingTable"; when(database.checkTableExists(nonExistingTable)).thenReturn(false); when(databaseMeta.getQuotedSchemaTableCombination((String) isNull(), eq(nonExistingTable))) .thenReturn(nonExistingTable); stagingTransformGenerator.dropTable(nonExistingTable); verify(database, never()).execStatement(anyString()); }
/** * Given a name of an existing table to drop. <br> * When StagingTransformGenerator is called to drop this table, then it should execute drop * statement. */ @Test public void shouldDropTableIfExists() throws Exception { String existingTable = "existingTable"; when(database.checkTableExists(existingTable)).thenReturn(true); when(databaseMeta.getQuotedSchemaTableCombination((String) isNull(), eq(existingTable))) .thenReturn(existingTable); stagingTransformGenerator.dropTable(existingTable); verify(database).execStatement("DROP TABLE existingTable"); }