added command line to create migrations
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user