added migration generation
This commit is contained in:
43
src/test/java/jef/model/ModelBuilderSimpleTest.java
Normal file
43
src/test/java/jef/model/ModelBuilderSimpleTest.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package jef.model;
|
||||
|
||||
import jef.DbSet;
|
||||
import jef.model.annotations.Clazz;
|
||||
import jef.model.annotations.Id;
|
||||
import jef.model.annotations.Index;
|
||||
import jef.model.annotations.Key;
|
||||
import jef.model.annotations.Unique;
|
||||
import jef.serializable.SerializableObject;
|
||||
import lombok.Getter;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class ModelBuilderSimpleTest {
|
||||
@Test
|
||||
public void testClone() {
|
||||
var mb = ModelBuilder.from(Ctx.class);
|
||||
|
||||
assertEquals(1, mb.getEntities().size());
|
||||
assertEquals("objects1", mb.getEntity(TestClass.class).getName());
|
||||
assertTrue(mb.getEntity(TestClass.class).getFields().stream().allMatch(e -> e.getEntity() == mb.getEntity(TestClass.class)));
|
||||
}
|
||||
|
||||
public static class Ctx extends DbContext {
|
||||
@Clazz(clazz = TestClass.class)
|
||||
private DbSet<TestClass> objects1;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class TestClass extends SerializableObject {
|
||||
@Id
|
||||
public int i = 1;
|
||||
public Object o = new Object();
|
||||
public double d;
|
||||
public float f;
|
||||
public long l;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user