mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Change to use enhancement for creating new entity bean instances
This commit is contained in:
@@ -4,8 +4,10 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.BeanState;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.tests.model.basic.MProtectedConstructBean;
|
||||
|
||||
public class TestProtectedConstructor extends BaseTestCase {
|
||||
@@ -22,6 +24,15 @@ public class TestProtectedConstructor extends BaseTestCase {
|
||||
// Note1 that the enhancement ClassAdapterEntity line 239 makes a default constructor publically accessible
|
||||
// Note2 the ClassAdpater will call DefaultConstructor.add() to add a default constructor if it doesn't exist
|
||||
|
||||
|
||||
EntityBean entityBean = (EntityBean)bean;
|
||||
Object newBeanInstance = entityBean._ebean_newInstance();
|
||||
|
||||
Assert.assertNotNull(newBeanInstance);
|
||||
BeanState beanState = Ebean.getBeanState(newBeanInstance);
|
||||
Assert.assertTrue(beanState.isNew());
|
||||
Assert.assertNotSame(entityBean, newBeanInstance);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user