Skip to content

Commit

Permalink
Added and fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rPraml committed Jun 14, 2023
1 parent 6fe3ec9 commit f63b013
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@
public class MySqlPlatformTest {

MySqlPlatform mySqlPlatform = new MySqlPlatform();

private static int X = 0xFFFFFF;
@Test
public void testTypeConversion() {
PlatformDdl ddl = PlatformDdlBuilder.create(mySqlPlatform);
assertThat(ddl.convert("clob")).isEqualTo("longtext");
assertThat(ddl.convert("clob(65535)")).isEqualTo("text");
assertThat(ddl.convert("clob(65536)")).isEqualTo("mediumtext");
assertThat(ddl.convert("clob(16777215)")).isEqualTo("mediumtext");
assertThat(ddl.convert("clob(16777216)")).isEqualTo("longtext");
assertThat(ddl.convert("json")).isEqualTo("json");
assertThat(ddl.convert("jsonb")).isEqualTo("json");
assertThat(ddl.convert("varchar(20)")).isEqualTo("varchar(20)");
assertThat(ddl.convert("boolean")).isEqualTo("tinyint(1)");
assertThat(ddl.convert("bit")).isEqualTo("tinyint(1)");
assertThat(ddl.convert("decimal")).isEqualTo("decimal(16,3)");


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void testTypeConversion() {
PlatformDdl ddl = PlatformDdlBuilder.create(platform);

assertThat(ddl.convert("clob")).isEqualTo("nvarchar(max)");
assertThat(ddl.convert("blob")).isEqualTo("image");
assertThat(ddl.convert("blob")).isEqualTo("varbinary(max)");
assertThat(ddl.convert("json")).isEqualTo("nvarchar(max)");
assertThat(ddl.convert("jsonb")).isEqualTo("nvarchar(max)");

Expand All @@ -32,6 +32,10 @@ public void testTypeConversion() {
assertThat(ddl.convert("bit")).isEqualTo("bit");
assertThat(ddl.convert("tinyint")).isEqualTo("smallint");
assertThat(ddl.convert("binary(16)")).isEqualTo("binary(16)");

assertThat(ddl.convert("varchar")).isEqualTo("nvarchar(255)");
assertThat(ddl.convert("varchar(4000)")).isEqualTo("nvarchar(4000)");
assertThat(ddl.convert("varchar(4001)")).isEqualTo("nvarchar(max)");
}

@Test
Expand Down

0 comments on commit f63b013

Please sign in to comment.