mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
Refactor move tests from ebean-core to ebean-test
This commit is contained in:
1 parent
0b00a14fd3
commit
eab56d323b
1650 files changed
+185
-147
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package org.tests.idkeys;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.TOne;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Test lazy loading
|
||||
*/
|
||||
public class TestLazyLoad extends BaseTestCase {
|
||||
/**
|
||||
* This test loads just a single property of the Entity AuditLog and later on access
|
||||
* the description which should force a lazy load of this property
|
||||
*/
|
||||
@Test
|
||||
public void testPartialLoad() throws SQLException {
|
||||
TOne log = new TOne();
|
||||
log.setName("test partial");
|
||||
log.setDescription("log");
|
||||
|
||||
server().save(log);
|
||||
|
||||
assertNotNull(log.getId());
|
||||
|
||||
List<TOne> logs = server().find(TOne.class)
|
||||
.select("id")
|
||||
.where().eq("id", log.getId())
|
||||
.findList();
|
||||
|
||||
assertNotNull(logs);
|
||||
assertEquals(1, logs.size());
|
||||
|
||||
TOne logLazy = logs.get(0);
|
||||
|
||||
String description = logLazy.getDescription();
|
||||
assertEquals(log.getDescription(), description);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user