mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
#2146 - no change - Tidy test only TestWithCacheAndLazyLoad
This commit is contained in:
1 parent
9dd28d8879
commit
f28f5c9a01
1 file changed
+13
-15
+13
-15
@@ -13,42 +13,40 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Noemi Szemenyei, FOCONIS AG
|
||||
*
|
||||
*/
|
||||
|
||||
public class TestWithCacheAndLazyLoad extends BaseTestCase{
|
||||
|
||||
@Test
|
||||
public void testGetters() {
|
||||
|
||||
|
||||
ChildWithCache child = new ChildWithCache();
|
||||
child.setId(1L);
|
||||
child.setName("Child With Cache");
|
||||
child.setAddress("Address");
|
||||
DB.save(child);
|
||||
|
||||
|
||||
ParentA parentA = new ParentA();
|
||||
parentA.setId(1L);
|
||||
parentA.setName("Parent A");
|
||||
parentA.setChild(child);
|
||||
DB.save(parentA);
|
||||
|
||||
|
||||
ParentB parentB = new ParentB();
|
||||
parentB.setId(1L);
|
||||
parentB.setChild(child);
|
||||
DB.save(parentB);
|
||||
|
||||
|
||||
|
||||
|
||||
ParentA tempA = DB.find(ParentA.class, 1L);
|
||||
tempA.getChild().getName(); //load name
|
||||
|
||||
tempA.getChild().getName(); // load name
|
||||
|
||||
ParentB tempB = DB.find(ParentB.class, 1L);
|
||||
|
||||
|
||||
ChildWithCache temp = tempB.getChild();
|
||||
//if the next line is commented out, the test passes
|
||||
temp.getName(); //load name from cache --> ebean_intercept.loadedFromCache = true
|
||||
|
||||
String tempLazyProp = temp.getAddress();
|
||||
assertThat(tempLazyProp).isEqualTo("Address");
|
||||
|
||||
// if the next line is commented out, the test passes
|
||||
temp.getName(); // load name from cache --> ebean_intercept.loadedFromCache = true
|
||||
|
||||
assertThat(temp.getAddress()).isEqualTo("Address");
|
||||
assertThat(temp.getName()).isEqualTo("Child With Cache");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user