mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor tests using assertSql() helper method
This helper method trims column alias from the sql (for Oracle)
This commit is contained in:
@@ -109,11 +109,11 @@ public class TestDeleteByQuery extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
if (isPlatformSupportsDeleteTableAlias()) {
|
||||
assertThat(sql.get(0)).contains("delete from bbookmark_user t0 where t0.id = ?");
|
||||
assertThat(sql.get(1)).contains("delete from bbookmark_user t0 where t0.id = ?");
|
||||
assertSql(sql.get(0)).contains("delete from bbookmark_user t0 where t0.id = ?");
|
||||
assertSql(sql.get(1)).contains("delete from bbookmark_user t0 where t0.id = ?");
|
||||
} else if (!isMySql()) {
|
||||
assertThat(sql.get(0)).contains("delete from bbookmark_user where id = ?");
|
||||
assertThat(sql.get(1)).contains("delete from bbookmark_user where id = ?");
|
||||
assertSql(sql.get(0)).contains("delete from bbookmark_user where id = ?");
|
||||
assertSql(sql.get(1)).contains("delete from bbookmark_user where id = ?");
|
||||
}
|
||||
|
||||
// and note this is the easiest option
|
||||
@@ -130,8 +130,8 @@ public class TestDeleteByQuery extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
// escalate to fetch ids then delete ... but no rows found
|
||||
assertThat(sql.get(0)).contains("select t0.id from contact t0 where t0.id = ?");
|
||||
assertThat(sql.get(1)).contains("select t0.id from contact t0 where t0.id = ?");
|
||||
assertSql(sql.get(0)).contains("select t0.id from contact t0 where t0.id = ?");
|
||||
assertSql(sql.get(1)).contains("select t0.id from contact t0 where t0.id = ?");
|
||||
|
||||
// and note this is the easiest option
|
||||
Ebean.delete(Contact.class, 7000);
|
||||
@@ -152,9 +152,9 @@ public class TestDeleteByQuery extends BaseTestCase {
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
if (isPlatformSupportsDeleteTableAlias()) {
|
||||
assertThat(sql.get(0)).contains("delete from contact t0 where t0.id = ?");
|
||||
assertSql(sql.get(0)).contains("delete from contact t0 where t0.id = ?");
|
||||
} else if (!isMySql()){
|
||||
assertThat(sql.get(0)).contains("delete from contact where id = ?");
|
||||
assertSql(sql.get(0)).contains("delete from contact where id = ?");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,9 +171,9 @@ public class TestDeleteByQuery extends BaseTestCase {
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
assertThat(sql).hasSize(1);
|
||||
if (isSqlServer()) {
|
||||
assertThat(sql.get(0)).contains("select t0.id from o_customer t0 with (updlock) where t0.name = ?");
|
||||
assertSql(sql.get(0)).contains("select t0.id from o_customer t0 with (updlock) where t0.name = ?");
|
||||
} else {
|
||||
assertThat(sql.get(0)).contains("select t0.id from o_customer t0 where t0.name = ?");
|
||||
assertSql(sql.get(0)).contains("select t0.id from o_customer t0 where t0.name = ?");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user