ソースを参照

BirthCertificate domain

Andrew Grant 2 ヶ月 前
コミット
e24b5e228e

+ 68 - 0
src/main/java/scot/carricksoftware/grantswriter/domains/certificates/birthcertificate/BirthCertificate.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.domains.certificates.birthcertificate;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import scot.carricksoftware.grantswriter.BaseEntity;
+import scot.carricksoftware.grantswriter.domains.people.Person;
+
+@Entity
+public class BirthCertificate extends BaseEntity {
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`new_born_id`")
+    private Person newBorn;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`father_id`")
+    private Person father;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`mother_id`")
+    private Person mother;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`informant_id`")
+    private Person informant;
+
+    public Person getNewBorn() {
+        return newBorn;
+    }
+
+    public void setNewBorn(Person newBorn) {
+        this.newBorn = newBorn;
+    }
+
+    public Person getFather() {
+        return father;
+    }
+
+    public void setFather(Person father) {
+        this.father = father;
+    }
+
+    public Person getMother() {
+        return mother;
+    }
+
+    public void setMother(Person mother) {
+        this.mother = mother;
+    }
+
+    public Person getInformant() {
+        return informant;
+    }
+
+    public void setInformant(Person informant) {
+        this.informant = informant;
+    }
+}

+ 85 - 0
src/test/java/scot/carricksoftware/grantswriter/domains/certificates/birthcertificate/BirthCertificateTest.java

@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.domains.certificates.birthcertificate;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grantswriter.domains.people.Person;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static scot.carricksoftware.grantswriter.GenerateRandomNumberValues.GetRandomLong;
+import static scot.carricksoftware.grantswriter.GenerateRandomPeopleValues.GetRandomPerson;
+
+class BirthCertificateTest {
+
+    BirthCertificate birthCertificate;
+
+    @BeforeEach
+    void setUp() {
+        birthCertificate = new BirthCertificate();
+    }
+
+    @Test
+    void getIDTest() {
+        assertNull(birthCertificate.getId());
+    }
+
+    @Test
+    void setIDTest() {
+        Long id = GetRandomLong();
+        birthCertificate.setId(id);
+        assertEquals(id, birthCertificate.getId());
+    }
+
+    @Test
+    void getNewBornTest() {
+        assertNull(birthCertificate.getNewBorn());
+    }
+
+    @Test
+    void setNewBornTest() {
+        Person person = GetRandomPerson();
+        birthCertificate.setNewBorn(person);
+        assertEquals(person, birthCertificate.getNewBorn());
+    }
+
+    @Test
+    void getFatherTest() {
+        assertNull(birthCertificate.getFather());
+    }
+
+    @Test
+    void setFatherTest() {
+        Person person = GetRandomPerson();
+        birthCertificate.setFather(person);
+        assertEquals(person, birthCertificate.getFather());
+    }
+
+    @Test
+    void getMotherTest() {
+        assertNull(birthCertificate.getMother());
+    }
+
+    @Test
+    void setMotherTest() {
+        Person person = GetRandomPerson();
+        birthCertificate.setMother(person);
+        assertEquals(person, birthCertificate.getMother());
+    }
+
+    @Test
+    void getInformantTest() {
+        assertNull(birthCertificate.getInformant());
+    }
+
+    @Test
+    void setInformantTest() {
+        Person person = GetRandomPerson();
+        birthCertificate.setInformant(person);
+        assertEquals(person, birthCertificate.getInformant());
+    }
+
+}

+ 3 - 3
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/GatherTimeLineDataTest.java

@@ -31,9 +31,9 @@ class GatherTimeLineDataTest {
     }
 
     @Test
-    void gatherTest(){
-       gatherTimeLineData.gather(personMock);
-       verify(gatherCensusTimeLineDataMock).gather(personMock);
+    void gatherTest() {
+        gatherTimeLineData.gather(personMock);
+        verify(gatherCensusTimeLineDataMock).gather(personMock);
     }
 
 }