mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Fix tests for sql server
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
@@ -11,7 +12,7 @@ import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestOnlyIdEntity {
|
||||
public class TestOnlyIdEntity extends BaseTestCase {
|
||||
|
||||
@ForPlatform({Platform.H2, Platform.POSTGRES})
|
||||
@Test
|
||||
|
||||
@@ -60,8 +60,12 @@ public class TestLazyForeignKeys extends BaseTestCase {
|
||||
List<String> loggedSql = LoggedSqlCollector.stop();
|
||||
assertThat(loggedSql).hasSize(3);
|
||||
assertThat(loggedSql.get(0)).contains("select t0.id, t0.attr1, t0.id1, t0.id2 from main_entity_relation");
|
||||
assertThat(loggedSql.get(1)).contains("select t0.id, t0.attr1, t0.attr2, t0.id is null from main_entity t0");
|
||||
assertThat(loggedSql.get(2)).contains("select t0.id, t0.attr1, t0.attr2, t0.id is null from main_entity t0");
|
||||
if (isSqlServer()) {
|
||||
assertThat(loggedSql.get(1)).contains("select t0.id, t0.attr1, t0.attr2, CASE WHEN t0.id is null THEN 1 ELSE 0 END from main_entity t0");
|
||||
} else {
|
||||
assertThat(loggedSql.get(1)).contains("select t0.id, t0.attr1, t0.attr2, t0.id is null from main_entity t0");
|
||||
assertThat(loggedSql.get(2)).contains("select t0.id, t0.attr1, t0.attr2, t0.id is null from main_entity t0");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -122,7 +122,11 @@ public class TestQueryJoinOnFormula extends BaseTestCase {
|
||||
List<String> loggedSql = LoggedSqlCollector.stop();
|
||||
assertEquals(1, loggedSql.size());
|
||||
assertThat(loggedSql.get(0)).contains("join (select order_id, count(*) as total_items,");
|
||||
assertThat(loggedSql.get(0)).contains("select t0.id, z_bt0.total_items from o_order t0 join (select order_id");
|
||||
if (isSqlServer()) {
|
||||
assertThat(loggedSql.get(0)).contains("select top 1 t0.id, z_bt0.total_items from o_order t0 join (select");
|
||||
} else {
|
||||
assertThat(loggedSql.get(0)).contains("select t0.id, z_bt0.total_items from o_order t0 join (select order_id");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user