Parcourir la source

GatherCensusTimeLineDataTest

Andrew Grant il y a 3 mois
Parent
commit
d5ea048e35

+ 51 - 0
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/GatherCensusTimeLineDataTest.java

@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts.people.subsections.helpers;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import scot.carricksoftware.grantswriter.data.TimeLineData;
+import scot.carricksoftware.grantswriter.domains.census.CensusEntry;
+import scot.carricksoftware.grantswriter.domains.people.Person;
+import scot.carricksoftware.grantswriter.services.censusentry.CensusEntryService;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+class GatherCensusTimeLineDataTest {
+
+    private GatherCensusTimeLineData gatherCensusTimeLineData;
+
+    @Mock
+    CensusEntryService censusEntryServiceMock;
+
+    @Mock
+    TimeLineData timeLineDataMock;
+
+    @Mock
+    Person personMock;
+
+    @BeforeEach
+    void setUp() {
+        gatherCensusTimeLineData = new GatherCensusTimeLineDataImpl(censusEntryServiceMock, timeLineDataMock);
+    }
+
+    @Test
+    void gatherTest() {
+        List<CensusEntry> censusEntryList = new ArrayList<>();
+        when(censusEntryServiceMock.findAllByPerson(personMock)).thenReturn(censusEntryList);
+        gatherCensusTimeLineData.gather(personMock);
+
+        verify(timeLineDataMock).add(censusEntryList);
+    }
+}

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

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts.people.subsections.helpers;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@ExtendWith(MockitoExtension.class)
+class GatherTimeLineDataTest {
+
+    private GatherTimeLineData gatherTimeLineData;
+
+
+    @Mock
+    private GatherCensusTimeLineData gatherCensusTimeLineDataMock;
+
+    @BeforeEach
+    void setUp() {
+        gatherTimeLineData = new GatherTimeLineDataImpl(gatherCensusTimeLineDataMock);
+    }
+
+    @Test
+    void constructorTest(){
+       assertNotNull(gatherTimeLineData);
+    }
+
+
+}