mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
* 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
45 lines
992 B
Java
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);
|
|
}
|
|
}
|