    @Test
    public void testGenerateMainClass() throws Exception {

        Connection connection = DatabaseManager.connectToDatabase("org.h2.Driver", "jdbc:h2:mem:rt-cg-main", "", "");
        assertNotNull(connection);
        File tempFile = Helpers.getResourceAsFile("codegenerator/test.sql");
        assertNotNull(tempFile);
        DatabaseManager.executePreparationScripts(connection, new File[]{tempFile});
        Catalog db = DatabaseManager.crawlDatabase(connection, new IncludeAll(), new IncludeAll());
        assertNotNull(db);

        List<TableModel> models = MetadataExtractor.extract(db);

        CodeGenerator cg = new CodeGenerator();
        String result = cg.generateMainClass(models, false);
        assertNotNull(result);
        assertEquals(Helpers.getResourceAsString("codegenerator/mainResult.java"), result);
        connection.close();

    }