Sfoglia il codice sorgente

Informants added to BirthCertificate domain

Andrew Grant 5 mesi fa
parent
commit
18cced4cce

+ 40 - 1
src/main/java/scot/carricksoftware/grants/domains/certificates/BirthCertificate.java

@@ -27,7 +27,7 @@ public class BirthCertificate extends BaseCertificate {
     private Person newBorn;
 
     @SuppressWarnings("JpaDataSourceORMInspection")
-    @Column(name= "`when_born`")
+    @Column(name = "`when_born`")
     @DateTimeFormat(pattern = ApplicationConstants.DATE_TIME_FORMAT)
     private String whenBorn;
 
@@ -67,6 +67,19 @@ public class BirthCertificate extends BaseCertificate {
     @Column(name = "`date_and_place_of_marriage`")
     private String dateAndPlaceOfMarriage;
 
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @ManyToOne()
+    @JoinColumn(name = "`informant_id`")
+    private Person informant;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`untracked_informant`")
+    private String untrackedInformant;
+
+    @SuppressWarnings("JpaDataSourceORMInspection")
+    @Column(name = "`informant_rank`")
+    private String informantRank;
+
     public Person getNewBorn() {
         return newBorn;
     }
@@ -146,4 +159,30 @@ public class BirthCertificate extends BaseCertificate {
     public void setDateAndPlaceOfMarriage(String dateAndPlaceOfMarriage) {
         this.dateAndPlaceOfMarriage = dateAndPlaceOfMarriage;
     }
+
+    public Person getInformant() {
+        return informant;
+    }
+
+    public void setInformant(Person informant) {
+        this.informant = informant;
+    }
+
+    public String getUntrackedInformant() {
+        return untrackedInformant;
+    }
+
+    public void setUntrackedInformant(String untrackedInformant) {
+        this.untrackedInformant = untrackedInformant;
+    }
+
+    public String getInformantRank() {
+        return informantRank;
+    }
+
+    public void setInformantRank(String informantRank) {
+        this.informantRank = informantRank;
+    }
+
+
 }

+ 61 - 0
src/test/java/scot/carricksoftware/grants/domains/certificates/BirthCertificatePartThreeTest.java

@@ -0,0 +1,61 @@
+/*
+ * 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 BirthCertificatePartThreeTest {
+
+    private BirthCertificate certificate;
+
+    @BeforeEach
+    void setUp() {
+        certificate = new BirthCertificate();
+    }
+
+    @Test
+    public void getInformantTest() {
+        assertNull(certificate.getInformant());
+    }
+
+    @Test
+    public void setInformantTest() {
+        Person informant = GetRandomPerson();
+        certificate.setInformant(informant);
+        assertEquals(informant, certificate.getInformant());
+    }
+
+    @Test
+    public void getUntrackedInformantTest() {
+        assertNull(certificate.getUntrackedInformant());
+    }
+
+    @Test
+    public void setUntrackedInformantTest() {
+        String untrackedInformant = GetRandomString();
+        certificate.setUntrackedInformant(untrackedInformant);
+        assertEquals(untrackedInformant, certificate.getUntrackedInformant());
+    }
+
+    @Test
+    public void getInformantRankTest() {
+        assertNull(certificate.getInformantRank());
+    }
+
+    @Test
+    public void setInformantRankTest() {
+        String informantRank = GetRandomString();
+        certificate.setInformantRank(informantRank);
+        assertEquals(informantRank, certificate.getInformantRank());
+    }
+}