forked from devonfw/cobigen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devonfw#860 Added first tests for sql generation
- Loading branch information
Showing
4 changed files
with
512 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 26 additions & 5 deletions
31
.../java/com/devonfw/cobigen/templates/devon4j/test/templates/SQLTemplateGenerationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
package com.devonfw.cobigen.templates.devon4j.test.templates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.Test; | ||
|
||
import com.devonfw.cobigen.templates.devon4j.test.templates.testclasses.SQLTestEntity; | ||
import com.devonfw.cobigen.templates.devon4j.test.templates.testclasses.SQLTestEntityDataTypes; | ||
import com.devonfw.cobigen.templates.devon4j.utils.SQLUtil; | ||
import org.assertj.core.api.Assertions; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class SQLTemplateGenerationTest extends AbstractJavaTemplateTest { | ||
@Test | ||
public void generateSQLTest() { | ||
String output = this.process(SQLTestEntity.class); | ||
|
||
String output = process(SQLTestEntity.class); | ||
} | ||
|
||
@Override | ||
public Class<?>[] getUtils() { | ||
|
||
return new Class<?>[] { SQLUtil.class }; | ||
} | ||
|
||
@Override | ||
public String getTemplatePath() { | ||
return "src/main/templates/sql_java_app/templates/V0000__Create_${variables.entityName}Entity.sql.ftl"; | ||
|
||
return "src/main/templates/sql_java_app/templates/V0000__Create_${variables.entityName}Entity.sql.ftl"; | ||
} | ||
|
||
/** | ||
* Test the correct generation of data types | ||
*/ | ||
@Test | ||
public void testDatatypeMapping() { | ||
|
||
String ouptut = process(SQLTestEntityDataTypes.class); | ||
assertThat(ouptut).contains("_timestamp2 TIMESTAMP").contains("_blob2 BLOB").contains("_bit BIT,") | ||
.contains("_date DATE").contains("_tinyint TINYINT").contains("_integer2 INTEGER").contains("_bigint BIGINT") | ||
.contains("_varchar3 VARCHAR").contains("_integer1 INTEGER").contains("_varchar4 VARCHAR") | ||
.contains("_clob CLOB").contains("_blob BLOB").contains("_varchar VARCHAR").contains("_char2 CHAR(1)") | ||
.contains(" _smallint SMALLINT").contains(" _char CHAR(1)").contains("_timestamp TIMESTAMP") | ||
.contains("_time TIME").contains("_numeric NUMERIC").contains("_varchar2 VARCHAR"); | ||
|
||
} | ||
} |
Oops, something went wrong.