Files
ebean/src/test/java/org/tests/idkeys/TestLazyLoad.java
T
Roland PramlandRob Bygrave 2001539755 Sqlserver support (#1053)
* made some tests sqlserver ready (No effective code change in src/main)

* FIX enhance packages and let all testcases inherit from BaseTestCase, so that they can be launched directly from eclipse

* ADD sqldriver in pom and datasource

* FIX: DDL-generation for sqlserver - not yet all sqlserver tests passing
mvn verify -Ddatasource.default=mssql => Tests run: 1980, Failures: 22, Errors: 44, Skipped: 16

* BaseDdlHandlerTest checks against correct sqlserver-ddl now
2017-07-03 20:27:37 +12:00

45 lines
992 B
Java

package org.tests.idkeys;
import org.junit.Test;
import org.tests.model.basic.TOne;
import io.ebean.BaseTestCase;
import static org.junit.Assert.*;
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);
}
}