From f63b013ef9ec7dc5e406bc17894039f634532e84 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 18:14:12 +0200 Subject: [PATCH] Added and fixed tests --- .../io/ebeaninternal/dbmigration/MySqlPlatformTest.java | 8 +++++++- .../ebeaninternal/dbmigration/SqlserverPlatformTest.java | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java index d94c17f6ae..305a27a4d6 100644 --- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java +++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java @@ -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)"); + + } } diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java index 402f7bfa95..407b80b727 100644 --- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java +++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java @@ -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)"); @@ -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