Package games.memory.state

Source Code of games.memory.state.TestPlayingState

package games.memory.state;

import static org.junit.Assert.*;
import games.memory.Memory;

import org.junit.Test;

/**
* Tests associated with PlayingState
* @author Ian Keefer
*/
public class TestPlayingState
{

  /**
   * tests the initlization of playing state
   */
  @Test
  public void testInitlization()
  {
    Memory.reset();
    Memory m = Memory.getInstance();
    MemoryState state = new PlayingState(m);
    m.setState(state);
    assertEquals(state, m.getState());
  }
 
  /**
   * tests handling the state and switching states
   */
  @Test
  public void testEndGame()
  {
    Memory.reset();
    Memory m = Memory.getInstance();
    MemoryState state = new PlayingState(m);
    m.setState(state);
    state.handle();
    assertTrue(m.getState() instanceof EndGameState);
  }

}
TOP

Related Classes of games.memory.state.TestPlayingState

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.