Selaa lähdekoodia

DateSortLinkedMultiValueMap framework

Andrew Grant 3 kuukautta sitten
vanhempi
commit
ec8b744fc3

+ 14 - 0
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/DateSortLinkedMultiValueMap.java

@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts.people.subsections.helpers;
+
+import org.springframework.util.LinkedMultiValueMap;
+
+public interface DateSortLinkedMultiValueMap {
+
+    @SuppressWarnings("SameReturnValue")
+    LinkedMultiValueMap<String, String> sort (@SuppressWarnings("unused") LinkedMultiValueMap<String, String> map);
+}

+ 18 - 0
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/DateSortLinkedMultiValueMapImpl.java

@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts.people.subsections.helpers;
+
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+
+@Component
+public class DateSortLinkedMultiValueMapImpl implements DateSortLinkedMultiValueMap {
+
+    @Override
+    public LinkedMultiValueMap<String, String> sort(LinkedMultiValueMap<String, String> map) {
+        return null;
+    }
+}

+ 4 - 1
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/WriteTimeLineImpl.java

@@ -25,13 +25,15 @@ public class WriteTimeLineImpl implements WriteTimeLine {
     private final FileWriter fileWriter;
     private final LatexLongTableStart latexLongTableStart;
     private final LatexLongTabLeEnd latexLongTabLeEnd;
+    private final DateSortLinkedMultiValueMap dateSortLinkedMultiValueMap;
 
     public WriteTimeLineImpl(FileWriter fileWriter,
                              LatexLongTableStart latexLongTableStart,
-                             LatexLongTabLeEnd latexLongTabLeEnd) {
+                             LatexLongTabLeEnd latexLongTabLeEnd, DateSortLinkedMultiValueMap dateSortLinkedMultiValueMap) {
         this.fileWriter = fileWriter;
         this.latexLongTableStart = latexLongTableStart;
         this.latexLongTabLeEnd = latexLongTabLeEnd;
+        this.dateSortLinkedMultiValueMap = dateSortLinkedMultiValueMap;
     }
 
     @Override
@@ -39,6 +41,7 @@ public class WriteTimeLineImpl implements WriteTimeLine {
         logger.info("PersonSubSectionTimeLineWriterImp::write");
 
         latexLongTableStart.write("l l");
+        map = dateSortLinkedMultiValueMap.sort(map);
         writeTheData(map);
         latexLongTabLeEnd.write();
     }

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

@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+class DateSortLinkedMultiValueMapTest {
+
+    @SuppressWarnings("unused")
+    private DateSortLinkedMultiValueMap underTest;
+
+    @BeforeEach
+    void setUp() {
+        underTest = new DateSortLinkedMultiValueMapImpl();
+    }
+
+    @Test
+    void constructorTest() {
+        underTest = new DateSortLinkedMultiValueMapImpl();
+    }
+}

+ 4 - 1
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/WriteTimeLineTest.java

@@ -30,9 +30,12 @@ class WriteTimeLineTest {
     @Mock
     private LatexLongTabLeEnd latexLongTabLeEndMock;
 
+    @Mock
+    private DateSortLinkedMultiValueMap dateSortLinkedMultiValueMapMock;
+
     @BeforeEach
     void setUp() {
-        writeTimeLine = new WriteTimeLineImpl(fileWriterMock, latexLongTableStartMock, latexLongTabLeEndMock);
+        writeTimeLine = new WriteTimeLineImpl(fileWriterMock, latexLongTableStartMock, latexLongTabLeEndMock, dateSortLinkedMultiValueMapMock);
     }
 
     @Test