mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed tests.
This commit is contained in:
@@ -70,4 +70,7 @@ public class ChatHistory extends ScrollPane {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -68,9 +68,11 @@ public class ChatCommandsTest {
|
||||
} catch (InterruptedException ie) {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
mst.terminate();
|
||||
host = null;
|
||||
client = null;
|
||||
mst = null;
|
||||
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
@@ -86,6 +88,11 @@ public class ChatCommandsTest {
|
||||
new GameState("localhost");
|
||||
mst = new MainServerThread();
|
||||
host = null;
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ie) {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
try {
|
||||
host = new ClientToServerThread("localhost", 4942);
|
||||
} catch (IOException ioe) {
|
||||
@@ -97,7 +104,7 @@ public class ChatCommandsTest {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
mst.startGame();
|
||||
host.sendChatterMessage("[time_prefix] <name_prefix> >speed 5.0");
|
||||
host.sendChatterMessage("[time_prefix] <name_prefix> >speed 5");
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ie) {
|
||||
@@ -106,7 +113,7 @@ public class ChatCommandsTest {
|
||||
Assert.assertEquals(5.0, GameState.getSpeedMultiplier(), 0.00001);
|
||||
mst.terminate();
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException ie) {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cucumber.api.java.en.Then;
|
||||
import cucumber.api.java.en.When;
|
||||
import javafx.util.Pair;
|
||||
import org.junit.Assert;
|
||||
import seng302.gameServer.GameState;
|
||||
import seng302.gameServer.MainServerThread;
|
||||
import seng302.model.stream.packets.StreamPacket;
|
||||
import seng302.utilities.StreamParser;
|
||||
@@ -24,6 +25,11 @@ public class SendChatSteps {
|
||||
@Given("^There are two games running$")
|
||||
public void the_are_two_games_running() throws Throwable {
|
||||
mst = new MainServerThread();
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ie) {
|
||||
ie.printStackTrace();
|
||||
}
|
||||
host = new ClientToServerThread("localhost", 4942);
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
|
||||
@@ -23,31 +23,32 @@ public class ToggleSailSteps {
|
||||
|
||||
@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);
|
||||
// Thread.sleep(200); // Sleep needed to help the threads all be up to speed with each other
|
||||
// ServerYacht yacht = (new ArrayList<>(GameState.getYachts().values())).get(0);
|
||||
// Assert.assertFalse(yacht.getSailIn());
|
||||
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
|
||||
ServerYacht 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();
|
||||
// if (arg1 == "shift") {
|
||||
// client.sendBoatAction(BoatAction.SAILS_IN);
|
||||
// }
|
||||
startTime = System.currentTimeMillis();
|
||||
if (arg1 == "shift") {
|
||||
client.sendBoatAction(BoatAction.SAILS_IN);
|
||||
}
|
||||
}
|
||||
|
||||
@Then("^the sails are \"([^\"]*)\"$")
|
||||
public void the_sails_are(String arg1) throws Throwable {
|
||||
// Thread.sleep(200); // Sleep needed to help the threads all be up to speed with each other
|
||||
// ServerYacht yacht = (new ArrayList<>(GameState.getYachts().values())).get(0);
|
||||
// if (arg1 == "in") {
|
||||
// Assert.assertTrue(yacht.getSailIn());
|
||||
// } else {
|
||||
// Assert.assertFalse(yacht.getSailIn());
|
||||
// }
|
||||
Thread.sleep(200); // Sleep needed to help the threads all be up to speed with each other
|
||||
ServerYacht yacht = (new ArrayList<>(GameState.getYachts().values())).get(0);
|
||||
if (arg1 == "in") {
|
||||
Assert.assertTrue(yacht.getSailIn());
|
||||
} else {
|
||||
Assert.assertFalse(yacht.getSailIn());
|
||||
}
|
||||
mst.terminate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user