diff options
| author | jrshi <jrs9538@g.rit.edu> | 2025-11-16 16:02:38 -0500 |
|---|---|---|
| committer | jrshi <jrs9538@g.rit.edu> | 2025-11-16 16:02:38 -0500 |
| commit | 0b43e258054b450f5007ef4d4fa34dacba2d8a9c (patch) | |
| tree | af8f64e4bdb6074fe2fb34c993850b6d81ce61de /src/test/java/design/model/GolferTest.java | |
| parent | 343d0baaaf718bfc9959484d187c4df1e171335e (diff) | |
| parent | af9f559a2ee427905c39363643bac2e7878fb10c (diff) | |
| download | designproject-design-6-league-play-refactoring.tar.gz designproject-design-6-league-play-refactoring.tar.bz2 designproject-design-6-league-play-refactoring.zip | |
Merge branch 'league-play-refactoring' of https://github.com/RIT-SWEN-262/designproject-design-6 into league-play-refactoringleague-play-refactoring
Merging?
Diffstat (limited to 'src/test/java/design/model/GolferTest.java')
| -rw-r--r-- | src/test/java/design/model/GolferTest.java | 18 |
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 |
