summary refs log tree commit diff stats
path: root/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'test/com')
-rw-r--r--test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java b/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java new file mode 100644 index 0000000..bc86459 --- /dev/null +++ b/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java
@@ -0,0 +1,52 @@
1package com.fourisland.fourpuzzle.gamestate.mapview.event.precondition;
2
3/*
4 * To change this template, choose Tools | Templates
5 * and open the template in the editor.
6 */
7
8import com.fourisland.fourpuzzle.Game;
9import com.fourisland.fourpuzzle.SaveFile;
10import org.junit.After;
11import org.junit.Before;
12import org.junit.Test;
13import static org.junit.Assert.*;
14
15/**
16 *
17 * @author hatkirby
18 */
19public class SwitchPreconditionTest {
20
21 public SwitchPreconditionTest() {
22 }
23
24 String switchName = "TestSwitch";
25 SwitchPrecondition sp;
26
27 @Before
28 public void setUp()
29 {
30 Game.setSaveFile(new SaveFile());
31 sp = new SwitchPrecondition(switchName);
32 }
33
34 @Test
35 public void testUnsetSwitch()
36 {
37 Game.getSaveFile().getSwitches().put(switchName, false);
38 assertFalse(sp.match());
39 }
40
41 @Test
42 public void testSetSwitch()
43 {
44 Game.getSaveFile().getSwitches().put(switchName, true);
45 assertTrue(sp.match());
46 }
47
48 @After
49 public void tearDown() {
50 }
51
52} \ No newline at end of file