@Test
public void testForeignKeySupport() throws Exception {

    for(DdlBuilderForeignKeySupport dbfs : foreignKeyDdlBuilders) {
        String ddl = dbfs.getDdlBuilder().createTables(database, false);
        if(dbfs.isSupportsOnDelete()) {
            if(Arrays.asList(dbfs.getOnDeleteForeignKeyAction()).contains(ForeignKeyAction.CASCADE)) {
                assertTrue("Failed to generate ON DELETE CASCADE for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ddl.contains(" ON DELETE CASCADE"));
            } else {
                assertTrue("Failed to generate ddl without ON DELETE CASCADE for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON DELETE CASCADE"));
            }
            
            // RESTRICT is always removed
            assertTrue("Failed to generate ddl without ON DELETE RESTRICT for the following platform: "
                    + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON DELETE RESTRICT"));
            
            // NO ACTION is always removed
            assertTrue("Failed to generate ddl without ON DELETE NO ACTION for the following platform: "
                    + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON DELETE NO ACTION"));
            
            if(Arrays.asList(dbfs.getOnDeleteForeignKeyAction()).contains(ForeignKeyAction.SETDEFAULT)) {
                assertTrue("Failed to generate ON DELETE SET DEFAULT for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ddl.contains(" ON DELETE SET DEFAULT"));
            } else {
                assertTrue("Failed to generate ddl without ON DELETE SET DEFAULT for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON DELETE SET DEFAULT"));
            }
            
            if(Arrays.asList(dbfs.getOnDeleteForeignKeyAction()).contains(ForeignKeyAction.SETNULL)) {
                assertTrue("Failed to generate ON DELETE SET NULL for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ddl.contains(" ON DELETE SET NULL"));
            } else {
                assertTrue("Failed to generate ddl without ON DELETE SET NULL for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON DELETE SET NULL"));
            }
        }
        if(dbfs.isSupportsOnUpdate()) {
            if(Arrays.asList(dbfs.getOnUpdateForeignKeyAction()).contains(ForeignKeyAction.CASCADE)) {
                assertTrue("Failed to generate ON UPDATE CASCADE for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ddl.contains(" ON UPDATE CASCADE"));
            } else {
                assertTrue("Failed to generate ddl without ON UPDATE CASCADE for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON UPDATE CASCADE"));
            }
            
            // RESTRICT is always removed
            assertTrue("Failed to generate ddl without ON UPDATE RESTRICT for the following platform: "
                    + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON UPDATE RESTRICT"));
            
            // NO ACTION is always removed
            assertTrue("Failed to generate ddl without ON UPDATE NO ACTION for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON UPDATE NO ACTION"));
            
            if(Arrays.asList(dbfs.getOnUpdateForeignKeyAction()).contains(ForeignKeyAction.SETDEFAULT)) {
                assertTrue("Failed to generate ON UPDATE SET DEFAULT for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ddl.contains(" ON UPDATE SET DEFAULT"));
            } else {
                assertTrue("Failed to generate ddl without ON UPDATE SET DEFAULT for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON UPDATE SET DEFAULT"));
            }
            if(Arrays.asList(dbfs.getOnUpdateForeignKeyAction()).contains(ForeignKeyAction.SETNULL)) {
                assertTrue("Failed to generate ON UPDATE SET NULL for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ddl.contains(" ON UPDATE SET NULL"));
            } else {
                assertTrue("Failed to generate ddl without ON UPDATE SET NULL for the following platform: "
                        + dbfs.getDdlBuilder().databaseName, ! ddl.contains("ON UPDATE SET NULL"));
            }
        }
    }
}