summary refs log tree commit diff stats
path: root/test/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPreconditionTest.java
blob: bc8645980e31a0863f92769a343a1dea526caf86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.fourisland.fourpuzzle.gamestate.mapview.event.precondition;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import com.fourisland.fourpuzzle.Game;
import com.fourisland.fourpuzzle.SaveFile;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author hatkirby
 */
public class SwitchPreconditionTest {

    public SwitchPreconditionTest() {
    }
    
    String switchName = "TestSwitch";
    SwitchPrecondition sp;

    @Before
    public void setUp()
    {
        Game.setSaveFile(new SaveFile());
        sp = new SwitchPrecondition(switchName);
    }
    
    @Test
    public void testUnsetSwitch()
    {
        Game.getSaveFile().getSwitches().put(switchName, false);
        assertFalse(sp.match());
    }
    
    @Test
    public void testSetSwitch()
    {
        Game.getSaveFile().getSwitches().put(switchName, true);
        assertTrue(sp.match());
    }

    @After
    public void tearDown() {
    }

}