summaryrefslogtreecommitdiff
path: root/src/test/java/design/model/GolferTest.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/java/design/model/GolferTest.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/test/java/design/model/GolferTest.java b/src/test/java/design/model/GolferTest.java
index 65229f3..83ca17b 100644
--- a/src/test/java/design/model/GolferTest.java
+++ b/src/test/java/design/model/GolferTest.java
@@ -10,6 +10,7 @@ import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import design.model.Club.ClubType;
+import design.model.undo.Memento;
import java.lang.reflect.Constructor;
import java.time.LocalDateTime;
@@ -35,10 +36,10 @@ public class GolferTest {
@Test
void testPrivateConstructor() throws Exception
{
- Constructor<Golfer> constructor = Golfer.class.getDeclaredConstructor(String.class, int.class, String.class, List.class, List.class, List.class);
+ Constructor<Golfer> constructor = Golfer.class.getDeclaredConstructor(String.class, int.class, String.class, List.class, List.class, List.class, List.class, Team.class);
assertTrue(Modifier.isPrivate(constructor.getModifiers()));
constructor.setAccessible(true);
- Golfer testGolfer = constructor.newInstance("testUser", 12345, "Test Golfer", new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
+ Golfer testGolfer = constructor.newInstance("testUser", 12345, "Test Golfer", new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null);
assertNotNull(testGolfer);
}
@@ -137,7 +138,16 @@ public class GolferTest {
assertEquals(expectedString, testGolfer.toString());
}
+ @Test
+ void testMemento()
+ {
+ Golfer testGolfer = new Golfer("John Doe", "jdoesgolf2", "weback4321");
+ Memento memento = testGolfer.createMemento();
+ testGolfer.setFullName("Joe Doe");
+ assertEquals("Joe Doe", testGolfer.getFullName());
+ testGolfer.restore(memento);
+ assertEquals("John Doe", testGolfer.getFullName());
+ }
-}
-
+} \ No newline at end of file