Working cucumber tests for sails toggle.

When sails in will send a sails out message when sails out will send a sails in message and then checks for the new status of the sail

#story[1111]
This commit is contained in:
Kusal Ekanayake
2017-08-13 14:55:33 +12:00
parent 2411a3cc2c
commit 25c2de63a2
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -34,8 +34,12 @@ public class ToggleSailSteps {
mst = new MainServerThread();
client = new ClientToServerThread("localhost", 4942);
GameState.setCurrentStage(GameStages.RACING);
Thread.sleep(200); // Sleep needed to help the threads all be up to speed with each other
Yacht yacht = (new ArrayList<>(GameState.getYachts().values())).get(0);
Assert.assertFalse(yacht.getSailIn());
}
@When("^the user has pressed \"([^\"]*)\"$")
public void the_user_has_pressed(String arg1) throws Throwable {
startTime = System.currentTimeMillis();
@@ -50,7 +54,12 @@ public class ToggleSailSteps {
@Then("^the sails are \"([^\"]*)\"$")
public void the_sails_are(String arg1) throws Throwable {
//Yacht yacht = (new ArrayList<>(GameState.getYachts().values())).get(0);
//Assert.assertTrue(yacht.getSailIn());
Thread.sleep(200); // Sleep needed to help the threads all be up to speed with each other
Yacht yacht = (new ArrayList<>(GameState.getYachts().values())).get(0);
if (arg1 == "in") {
Assert.assertTrue(yacht.getSailIn());
} else {
Assert.assertFalse(yacht.getSailIn());
}
}
}