Browse Source

Birth Certificate family in domain

Andrew Grant 6 months ago
parent
commit
55a597be43

+ 2 - 1
docs/additions.txt

@@ -9,12 +9,13 @@
 8: Bootstrap (use personal details)
 9: Bootstrap Test
 10: Modify the form
+10.1: Uppercase on save
 11: Validator
 12: Validator Test
 13: Switch to uat
 13A: In the database window select the uat database *** and then refresh it***
 14: Generate changelog (ctrl-shift-A) as sql
-14A:Edit the file to add COLUMN IF NOT EXISTS to the entries
+14.1 :Edit the file to add COLUMN IF NOT EXISTS to the entries
 15: Add the new file to master.xml
 16: Run in terminal  mvn clean test liquibase:update
 

+ 62 - 0
src/main/java/scot/carricksoftware/grants/domains/certificates/BirthCertificate.java

@@ -39,6 +39,28 @@ public class BirthCertificate extends BaseCertificate {
     @Column(name = "`sex`")
     private Sex sex;
 
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`father_id`")
+    private Person father;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`untracked_father`")
+    private String untrackedFather;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`father_rank`")
+    private String fatherRank;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`mother_id`")
+    private Person mother;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`date_and_place_of_marriage`")
+    private String dateAndPlaceOfMarriage;
+
     public Person getNewBorn() {
         return newBorn;
     }
@@ -70,4 +92,44 @@ public class BirthCertificate extends BaseCertificate {
     public void setSex(Sex sex) {
         this.sex = sex;
     }
+
+    public Person getFather() {
+        return father;
+    }
+
+    public void setFather(Person father) {
+        this.father = father;
+    }
+
+    public String getUntrackedFather() {
+        return untrackedFather;
+    }
+
+    public void setUntrackedFather(String untrackedFather) {
+        this.untrackedFather = untrackedFather;
+    }
+
+    public String getFatherRank() {
+        return fatherRank;
+    }
+
+    public void setFatherRank(String fatherRank) {
+        this.fatherRank = fatherRank;
+    }
+
+    public Person getMother() {
+        return mother;
+    }
+
+    public void setMother(Person mother) {
+        this.mother = mother;
+    }
+
+    public String getDateAndPlaceOfMarriage() {
+        return dateAndPlaceOfMarriage;
+    }
+
+    public void setDateAndPlaceOfMarriage(String dateAndPlaceOfMarriage) {
+        this.dateAndPlaceOfMarriage = dateAndPlaceOfMarriage;
+    }
 }

+ 88 - 0
src/test/java/scot/carricksoftware/grants/domains/certificates/BirthCertificateParentsTest.java

@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 17:20. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.domains.certificates;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grants.domains.people.Person;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
+
+
+class BirthCertificateParentsTest {
+
+    private BirthCertificate certificate;
+
+    @BeforeEach
+    void setUp() {
+        certificate = new BirthCertificate();
+    }
+
+    @Test
+    void getFatherTest() {
+        assertNull(certificate.getFather());
+    }
+
+    @Test
+    void setFatherTest() {
+        Person father = GetRandomPerson();
+        certificate.setFather(father);
+        assertEquals(father, certificate.getFather());
+    }
+
+    @Test
+    void getUntrackedFatherTest() {
+        assertNull(certificate.getUntrackedFather());
+    }
+
+    @Test
+    void setUntrackedFatherTest() {
+        String untrackedFather = GetRandomString();
+        certificate.setUntrackedFather(untrackedFather);
+        assertEquals(untrackedFather, certificate.getUntrackedFather());
+    }
+
+    @Test
+    void getFatherRankTest() {
+        assertNull(certificate.getFatherRank());
+    }
+
+    @Test
+    void setFatherRankTest() {
+        String fatherRank = GetRandomString();
+        certificate.setFatherRank(fatherRank);
+        assertEquals(fatherRank, certificate.getFatherRank());
+    }
+
+    @Test
+    void MotherTest() {
+        assertNull(certificate.getMother());
+    }
+
+    @Test
+    void setMotherTest() {
+        Person mother = GetRandomPerson();
+        certificate.setMother(mother);
+        assertEquals(mother, certificate.getMother());
+    }
+
+    @Test
+    void getDateAndPlaceOfMarriageTest() {
+        assertNull(certificate.getDateAndPlaceOfMarriage());
+    }
+
+    @Test
+    void setDateAndPLaceOfMarriageTest() {
+        String dateAndPLaceOfMarriage = GetRandomString();
+        certificate.setDateAndPlaceOfMarriage(dateAndPLaceOfMarriage);
+        assertEquals(dateAndPLaceOfMarriage, certificate.getDateAndPlaceOfMarriage());
+    }
+
+
+}