Adjust tests for JDK 18-ea build

This commit is contained in:
Rob Bygrave
2021-12-07 15:15:21 +13:00
parent 103f965182
commit 9d26ab2103
2 changed files with 20 additions and 17 deletions
@@ -13,13 +13,12 @@ import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
public class TestLoadBeanCache extends BaseTestCase {
class TestLoadBeanCache extends BaseTestCase {
@Test
public void testLoad() {
void testLoad() {
ResetBasicData.reset();
@@ -35,32 +34,29 @@ public class TestLoadBeanCache extends BaseTestCase {
// this will hit the cache
Country nz = DB.find(Country.class, "NZ");
assertTrue(loadedNz == nz);
assertSame(loadedNz, nz);
}
@Test
public void testLoadWithFindMap() {
void testLoadWithFindMap() {
ResetBasicData.reset();
List<Object> ids = DB.find(Customer.class).findIds();
assertEquals(ids.size(), 4);
assertThat(ids).isNotEmpty();
DB.getDefault().pluginApi().cacheManager().clearAll();
// hit database
LoggedSql.start();
DB.find(Customer.class).where().idIn(ids).findMap();
List<String> sql = LoggedSql.stop();
assertThat(sql).hasSize(1);
// hit beanCache
LoggedSql.start();
DB.find(Customer.class).where().idIn(ids).findMap();
sql = LoggedSql.stop();
assertThat(sql).hasSize(0);
}
}