mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
No effective change - tidy TestWithCacheAndLazyLoad
This commit is contained in:
1 parent
946b390037
commit
75b9df942c
1 file changed
+11
-13
+11
-13
@@ -3,24 +3,22 @@ package org.tests.model.lazywithcache;
|
|||||||
import io.ebean.BaseTestCase;
|
import io.ebean.BaseTestCase;
|
||||||
import io.ebean.DB;
|
import io.ebean.DB;
|
||||||
import io.ebean.Transaction;
|
import io.ebean.Transaction;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with bean cache and lazy loaded property.
|
* Test with bean cache and lazy loaded property.
|
||||||
*
|
*
|
||||||
* @author Noemi Szemenyei, FOCONIS AG
|
* @author Noemi Szemenyei, FOCONIS AG
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class TestWithCacheAndLazyLoad extends BaseTestCase{
|
class TestWithCacheAndLazyLoad extends BaseTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetters() {
|
void testGetters() {
|
||||||
|
|
||||||
ChildWithCache child = new ChildWithCache();
|
ChildWithCache child = new ChildWithCache();
|
||||||
child.setId(1L);
|
child.setId(1L);
|
||||||
@@ -52,19 +50,19 @@ public class TestWithCacheAndLazyLoad extends BaseTestCase{
|
|||||||
assertThat(temp.getAddress()).isEqualTo("Address");
|
assertThat(temp.getAddress()).isEqualTo("Address");
|
||||||
assertThat(temp.getName()).isEqualTo("Child With Cache");
|
assertThat(temp.getName()).isEqualTo("Child With Cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatch() throws Exception {
|
void testBatch() {
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
ChildWithCache child = new ChildWithCache();
|
ChildWithCache child = new ChildWithCache();
|
||||||
child.setId(1000L+i);
|
child.setId(1000L + i);
|
||||||
child.setName("Child With Cache "+ i);
|
child.setName("Child With Cache " + i);
|
||||||
child.setAddress("Address");
|
child.setAddress("Address");
|
||||||
DB.save(child);
|
DB.save(child);
|
||||||
|
|
||||||
ParentA parentA = new ParentA();
|
ParentA parentA = new ParentA();
|
||||||
parentA.setId(1000L+i);
|
parentA.setId(1000L + i);
|
||||||
parentA.setName("Parent A");
|
parentA.setName("Parent A");
|
||||||
parentA.setChild(child);
|
parentA.setChild(child);
|
||||||
DB.save(parentA);
|
DB.save(parentA);
|
||||||
@@ -72,7 +70,7 @@ public class TestWithCacheAndLazyLoad extends BaseTestCase{
|
|||||||
// 0. load cache
|
// 0. load cache
|
||||||
ParentA temp = DB.find(ParentA.class, 1000L);
|
ParentA temp = DB.find(ParentA.class, 1000L);
|
||||||
temp.getChild().getName();
|
temp.getChild().getName();
|
||||||
|
|
||||||
try (Transaction txn = DB.beginTransaction()) {
|
try (Transaction txn = DB.beginTransaction()) {
|
||||||
// 1. FindList
|
// 1. FindList
|
||||||
List<ParentA> list = DB.find(ParentA.class).where().ge("id", 1000L).orderBy("id").findList();
|
List<ParentA> list = DB.find(ParentA.class).where().ge("id", 1000L).orderBy("id").findList();
|
||||||
|
|||||||
Reference in new issue
Block a user