added command line to create migrations

This commit is contained in:
wea_ondara
2022-11-23 13:50:54 +01:00
parent 17d71eb2f3
commit 915fc4a87b
43 changed files with 1183 additions and 61 deletions

View File

@@ -0,0 +1,39 @@
package jef.model;
import jef.model.annotations.Id;
import jef.serializable.SerializableObject;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
class EntityDefaultConstructorCheckerTest {
@Test
public void test0ArgConstructor() {
var mb = new ModelBuilder();
EntityDefaultConstructorChecker.checkEntity(mb.entity(TestClass0Arg.class));
assertTrue(true);
}
@Test
public void testNon0ArgConstructor() {
var mb = new ModelBuilder();
var ex = assertThrows(ModelException.class, () -> EntityDefaultConstructorChecker.checkEntity(mb.entity(TestClassNon0Arg.class)));
assertEquals("Class 'TestClassNon0Arg' does not have a default constructor!", ex.getMessage());
}
@NoArgsConstructor
public static class TestClass0Arg extends SerializableObject {
@Id
public int i = 1;
}
@AllArgsConstructor
public static class TestClassNon0Arg extends SerializableObject {
@Id
public int i = 1;
}
}