|
@@ -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);
|
|
|
|
+ }
|
|
|
|
+}
|