Package gameMechanics

Source Code of gameMechanics.MsgAddClickTest

package gameMechanics;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import org.junit.Test;


import modules.Address;

public class MsgAddClickTest {

 
  @Test
  public void testSettingSessionIdsAndAddresses() throws Exception {
    Address From = new Address();
    Address To = new Address();
    int sessionId = 1;
    int gameSessionId = 2;
    int sessionIdAdd = 3;
    MsgAddClick msg = new MsgAddClick (From, To, sessionIdAdd,
        gameSessionId, sessionId);
    assertEquals(sessionId, msg.getSessionId());
    assertEquals(gameSessionId, msg.getGameSessionId());
    assertEquals(sessionIdAdd, msg.getSessionIdAdd());
    assertTrue(From.equals(msg.getFrom()));
    assertTrue(To.equals(msg.getTo()));
   
   }
 
  @Test
  public void execTest() {
    Address From = new Address();
    Address To = new Address();
    int sessionId = 1;
    int gameSessionId = 2;
    int sessionIdAdd = 3;
    MsgAddClick msg = new MsgAddClick (From, To, sessionIdAdd,
        gameSessionId, sessionId);
    GameMechanics someGameMechanics = mock(GameMechanics.class);
    msg.exec(someGameMechanics);
    verify(someGameMechanics).addClick(sessionIdAdd, gameSessionId, sessionId);
  }
}
TOP

Related Classes of gameMechanics.MsgAddClickTest

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.