mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Started work on cucumber tests. Trying to sort through threads, getting inconsistent results.
#story[1111] #pair[kre39,ptg19]
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package steps;
|
||||
|
||||
import cucumber.api.java.en.Given;
|
||||
import cucumber.api.java.en.Then;
|
||||
import cucumber.api.java.en.When;
|
||||
import seng302.gameServer.GameStages;
|
||||
import seng302.gameServer.GameState;
|
||||
import seng302.gameServer.MainServerThread;
|
||||
import seng302.gameServer.server.messages.BoatActionMessage;
|
||||
import seng302.gameServer.server.messages.BoatActionType;
|
||||
import seng302.model.Yacht;
|
||||
import seng302.visualiser.ClientToServerThread;
|
||||
|
||||
/**
|
||||
* Created by kre39 on 7/08/17.
|
||||
*/
|
||||
public class ToggleSailSteps {
|
||||
|
||||
|
||||
MainServerThread mst;
|
||||
ClientToServerThread client;
|
||||
boolean sailsIn = false;
|
||||
long startTime;
|
||||
private Yacht yacht;
|
||||
|
||||
|
||||
|
||||
@Given("^The game is running$")
|
||||
public void the_game_is_running() throws Throwable {
|
||||
mst = new MainServerThread();
|
||||
client = new ClientToServerThread("localhost", 4942);
|
||||
GameState.setCurrentStage(GameStages.RACING);
|
||||
}
|
||||
|
||||
@When("^the user has pressed \"([^\"]*)\"$")
|
||||
public void the_user_has_pressed(String arg1) throws Throwable {
|
||||
startTime = System.currentTimeMillis();
|
||||
if (arg1 == "shift") {
|
||||
if (sailsIn) {
|
||||
client.sendBoatActionMessage(new BoatActionMessage(BoatActionType.SAILS_OUT));
|
||||
} else {
|
||||
client.sendBoatActionMessage(new BoatActionMessage(BoatActionType.SAILS_IN));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Then("^the sails are \"([^\"]*)\"$")
|
||||
public void the_sails_are(String arg1) throws Throwable {
|
||||
System.out.println(GameState.getYachts().values());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user