more tests

This commit is contained in:
wea_ondara
2022-09-08 17:12:03 +02:00
parent 445d3f4a9c
commit cdd650c1de

View File

@@ -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;
}
}