mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2766 - Failing test for reference bean created from JSON allows lazy loading.
This commit is contained in:
@@ -17,11 +17,24 @@ import org.tests.model.basic.ResetBasicData;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TestTextJsonReferenceBean extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
void fromJson_refBean_shouldNotLazyLoadByDefault() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
JsonContext jsonContext = DB.json();
|
||||
Product productRefBean = jsonContext.toBean(Product.class, "{\"id\": 1}");
|
||||
|
||||
assertThat(DB.beanState(productRefBean).isReference()).isTrue();
|
||||
// does not lazy load by default
|
||||
assertThat(productRefBean.getName()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user