tried to test BoatPositionController but as it's connected to the fxml I am unsure if it is possible to test (test code is commented out) #story[426]

This commit is contained in:
Peter
2017-03-23 22:04:25 +13:00
parent a860cc0ec1
commit bf8244ce49
3 changed files with 52 additions and 0 deletions
+6
View File
@@ -25,6 +25,12 @@
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.7.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@@ -42,4 +42,8 @@ public class BoatPositionController {
positionVbox.getChildren().add(new Text(boat.getTeamName()));
}
}
public ArrayList<Boat> getBoatOrder() {
return boatOrder;
}
}
@@ -0,0 +1,42 @@
package seng302.controllers;
import org.junit.Test;
import seng302.models.Boat;
import seng302.models.Event;
import seng302.models.mark.SingleMark;
import java.util.ArrayList;
import java.util.Arrays;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
/**
* Created by ptg19 on 23/03/17.
*/
public class BoatPositionControllerTest {
@Test
public void handleEvent() throws Exception {
// BoatPositionController controller = new BoatPositionController();
// Boat boat1 = new Boat("boat1");
// Boat boat2 = new Boat("boat2");
// Boat boat3 = new Boat("boat3");
//
// Event event1 = new Event(1.0, boat1, new SingleMark("mark0"), new SingleMark("mark1"), 0);
// Event event2 = new Event(1.0, boat2, new SingleMark("mark0"), new SingleMark("mark1"), 0);
// Event event3 = new Event(1.0, boat3, new SingleMark("mark0"), new SingleMark("mark1"), 0);
// controller.handleEvent(event1);
// controller.handleEvent(event2);
// controller.handleEvent(event3);
// assertEquals(controller.getBoatOrder(), new ArrayList<Boat>(Arrays.asList(boat1, boat2, boat3)));
// Event event4 = new Event(1.0, boat3, new SingleMark("mark1"), new SingleMark("mark2"), 0);
// Event event5 = new Event(1.0, boat3, new SingleMark("mark1"), new SingleMark("mark2"), 1);
// Event event6 = new Event(1.0, boat3, new SingleMark("mark1"), new SingleMark("mark2"), 1);
// Event event7 = new Event(1.0, boat3, new SingleMark("mark1"), new SingleMark("mark2"), 1);
// Event event8 = new Event(1.0, boat3, new SingleMark("mark1"), new SingleMark("mark2"), 1);
// Event event9 = new Event(1.0, boat3, new SingleMark("mark1"), new SingleMark("mark2"), 1);
}
}