Bläddra i källkod

WriteParts::write

Andrew Grant 4 månader sedan
förälder
incheckning
01a22beef8

+ 11 - 0
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/PeopleParts.java

@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts;
+
+public interface PeopleParts {
+
+    void write();
+}

+ 21 - 0
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/PeoplePartsImpl.java

@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PeoplePartsImpl implements PeopleParts {
+
+    private static final Logger logger = LogManager.getLogger(PeoplePartsImpl.class);
+
+    @Override
+    public void write() {
+        logger.info("PeoplePartsImpl.write()");
+    }
+}

+ 7 - 0
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/WritePartsImpl.java

@@ -14,8 +14,15 @@ public class WritePartsImpl implements WriteParts {
 
     private static final Logger logger = LogManager.getLogger(WritePartsImpl.class);
 
+    private final PeopleParts peopleParts;
+
+    public WritePartsImpl(PeopleParts peopleParts) {
+        this.peopleParts = peopleParts;
+    }
+
     @Override
     public void write() {
         logger.info("WritePartsImpl.write()");
+        peopleParts.write();
     }
 }

+ 17 - 0
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/PeoplePartsTest.java

@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grantswriter.writer.latex.parts;
+
+import org.junit.jupiter.api.BeforeEach;
+
+
+class PeoplePartsTest {
+
+    @SuppressWarnings("EmptyMethod")
+    @BeforeEach
+    void setUp() {
+    }
+}

+ 14 - 2
src/test/java/scot/carricksoftware/grantswriter/writer/latex/parts/WritePartsTest.java

@@ -7,21 +7,33 @@ package scot.carricksoftware.grantswriter.writer.latex.parts;
 
 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.springframework.test.context.junit.jupiter.SpringExtension;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.mockito.Mockito.verify;
 
-
+@ExtendWith(SpringExtension.class)
 class WritePartsTest {
 
     private WriteParts writeParts;
 
+    @Mock
+    PeopleParts peoplePartsMock;
+
     @BeforeEach
     void setUp() {
-        writeParts = new WritePartsImpl();
+        writeParts = new WritePartsImpl(peoplePartsMock);
     }
 
     @Test
     void constructorTest(){
         assertNotNull(writeParts);
     }
+
+    @Test
+    void writeTest(){
+        verify(writeParts).write();
+    }
 }