summary refs log tree commit diff stats
path: root/test/com/fourisland
diff options
context:
space:
mode:
Diffstat (limited to 'test/com/fourisland')
-rw-r--r--test/com/fourisland/fourpuzzle/gamestate/mapview/event/ImmutableEventTest.java56
-rw-r--r--test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java9
2 files changed, 57 insertions, 8 deletions
diff --git a/test/com/fourisland/fourpuzzle/gamestate/mapview/event/ImmutableEventTest.java b/test/com/fourisland/fourpuzzle/gamestate/mapview/event/ImmutableEventTest.java new file mode 100644 index 0000000..31e52a0 --- /dev/null +++ b/test/com/fourisland/fourpuzzle/gamestate/mapview/event/ImmutableEventTest.java
@@ -0,0 +1,56 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6package com.fourisland.fourpuzzle.gamestate.mapview.event;
7
8import com.fourisland.fourpuzzle.Direction;
9import com.fourisland.fourpuzzle.Layer;
10import com.fourisland.fourpuzzle.gamestate.mapview.Map;
11import java.awt.Point;
12import java.util.ArrayList;
13import java.util.List;
14import org.junit.After;
15import org.junit.AfterClass;
16import org.junit.Before;
17import org.junit.BeforeClass;
18import org.junit.Test;
19import static org.junit.Assert.*;
20
21/**
22 *
23 * @author hatkirby
24 */
25public class ImmutableEventTest {
26
27 ImmutableEvent ie;
28 Event ev;
29
30 @Before
31 public void setUp()
32 {
33 LayerEvent temp = new LayerEvent(1, 2, "Test");
34 temp.addEvent(new PossibleEvent());
35
36 ev = temp;
37 ie = new ImmutableEvent(ev);
38 }
39
40 @Test
41 public void testLiveness()
42 {
43 // First, modify the internal event
44 ev.setAnimationStep(2);
45 ev.setDirection(Direction.East);
46 ev.setLocation(1, 3);
47 ev.setMoveSpeed(MoveSpeed.Slower2);
48
49 // Then, ensure that the immutable event reflects these changes
50 assertEquals(ie.getAnimationStep(), 2);
51 assertEquals(ie.getDirection(), Direction.East);
52 assertEquals(ie.getLocation(), new Point(1, 3));
53 assertEquals(ie.getMoveSpeed(), MoveSpeed.Slower2);
54 }
55
56} \ No newline at end of file
diff --git a/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java b/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java index bc86459..dd8d5b5 100644 --- a/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java +++ b/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java
@@ -18,9 +18,6 @@ import static org.junit.Assert.*;
18 */ 18 */
19public class SwitchPreconditionTest { 19public class SwitchPreconditionTest {
20 20
21 public SwitchPreconditionTest() {
22 }
23
24 String switchName = "TestSwitch"; 21 String switchName = "TestSwitch";
25 SwitchPrecondition sp; 22 SwitchPrecondition sp;
26 23
@@ -44,9 +41,5 @@ public class SwitchPreconditionTest {
44 Game.getSaveFile().getSwitches().put(switchName, true); 41 Game.getSaveFile().getSwitches().put(switchName, true);
45 assertTrue(sp.match()); 42 assertTrue(sp.match());
46 } 43 }
47 44
48 @After
49 public void tearDown() {
50 }
51
52} \ No newline at end of file 45} \ No newline at end of file