more tests
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
package jef.model;
|
||||||
|
|
||||||
|
import jef.DbSet;
|
||||||
|
import jef.model.annotations.Clazz;
|
||||||
|
import jef.model.annotations.Id;
|
||||||
|
import jef.serializable.SerializableObject;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrowsExactly;
|
||||||
|
|
||||||
|
class EntityInitializerDbSetAnnotationClassInheritTest {
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
assertEquals("DbSet objects1 has a class in its Clazz annotation that does not inherit from SerializableObject: int",
|
||||||
|
assertThrowsExactly(ModelException.class, () -> ModelBuilder.from(Ctx.class)).getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Ctx extends DbContext {
|
||||||
|
@Clazz(int.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