ENH: Add query.usingDatabase(database)

This commit is contained in:
rob bygrave
2020-02-19 11:41:06 +13:00
parent 78b9066345
commit e9325a81f7
4 changed files with 40 additions and 3 deletions
@@ -2,6 +2,7 @@ package org.tests.basic;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import io.ebean.Database;
import io.ebean.Transaction;
import io.ebean.annotation.IgnorePlatform;
import io.ebean.annotation.Platform;
@@ -18,6 +19,21 @@ import static org.junit.Assert.assertEquals;
public class TestQueryUsingConnection extends BaseTestCase {
@Test
public void usingDatabase() {
ResetBasicData.reset();
final Database database = DB.getDefault();
int count =
DB.find(Country.class)
.usingDatabase(database)
.findCount();
assertThat(count).isGreaterThan(0);
}
@Test
public void usingConnection() throws SQLException {