|
@@ -17,7 +17,9 @@ import scot.carricksoftware.grantswriter.enums.census.CensusDate;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
import java.util.SortedSet;
|
|
|
+import java.util.TreeMap;
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
import static org.mockito.Mockito.when;
|
|
@@ -62,6 +64,36 @@ class TimeLineDataAddTest {
|
|
|
refs = timeLineData.getRefs();
|
|
|
|
|
|
assertEquals("Edinburgh", refs.first());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void timeLineAddCensusEntryTest() {
|
|
|
+ List<CensusEntry> censusEntryList = new ArrayList<>();
|
|
|
+ CensusEntry censusEntry = new CensusEntry();
|
|
|
+
|
|
|
+ censusEntry.setCensus(censusMock);
|
|
|
+ censusEntry.setPersonalOccupation("Work");
|
|
|
+ censusEntryList.add(censusEntry);
|
|
|
+
|
|
|
+ when(placeMock.toString()).thenReturn("Edinburgh");
|
|
|
+
|
|
|
+ when(censusMock.getCensusDate()).thenReturn(CensusDate.CENSUS_1861);
|
|
|
+ when(censusMock.getPlace()).thenReturn(placeMock);
|
|
|
+
|
|
|
+
|
|
|
+ timeLineData.add(censusEntryList);
|
|
|
+
|
|
|
+ TreeMap<DMY, List<String>> timeLine = timeLineData.getTimeLine();
|
|
|
+
|
|
|
+ String requiredRecorded = "Recorded as being at Edinburgh";
|
|
|
+ String requiredOccupation = "Occupation recorded as Work";
|
|
|
+ assertEquals(1, timeLine.size());
|
|
|
|
|
|
+ Set<DMY> keys = timeLine.keySet();
|
|
|
+ for (DMY key : keys) {
|
|
|
+ List<String> values = timeLine.get(key);
|
|
|
+ assert(values.contains(requiredRecorded));
|
|
|
+ assert(values.contains(requiredOccupation));
|
|
|
+ }
|
|
|
}
|
|
|
}
|