Commit 0ab3167d authored by Jakob Schöttl's avatar Jakob Schöttl
Browse files

Add tests for new methods

parent df056eae
...@@ -12,6 +12,7 @@ import org.vadere.simulator.models.seating.TestTopographyAndModelBuilder; ...@@ -12,6 +12,7 @@ import org.vadere.simulator.models.seating.TestTopographyAndModelBuilder;
import org.vadere.state.attributes.models.seating.SeatFacingDirection; import org.vadere.state.attributes.models.seating.SeatFacingDirection;
import org.vadere.state.attributes.models.seating.SeatRelativePosition; import org.vadere.state.attributes.models.seating.SeatRelativePosition;
import org.vadere.state.attributes.models.seating.SeatSide; import org.vadere.state.attributes.models.seating.SeatSide;
import org.vadere.state.attributes.models.seating.model.SeatPosition;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
public class TestSeatGroup { public class TestSeatGroup {
...@@ -348,6 +349,25 @@ public class TestSeatGroup { ...@@ -348,6 +349,25 @@ public class TestSeatGroup {
assertTrue(aSeatGroup.isFull()); assertTrue(aSeatGroup.isFull());
} }
@Test
public void testIsAtLeftSide() {
assertTrue(aSeatGroup.isAtLeftSide());
assertFalse(rightSeatGroup.isAtLeftSide());
}
@Test
public void testGetSeatByPosition() {
assertEquals(aSeatGroup.getSeat(0), aSeatGroup.getSeatByPosition(SeatPosition.WINDOW_BACKWARD));
assertEquals(aSeatGroup.getSeat(1), aSeatGroup.getSeatByPosition(SeatPosition.AISLE_BACKWARD));
assertEquals(aSeatGroup.getSeat(2), aSeatGroup.getSeatByPosition(SeatPosition.WINDOW_FORWARD));
assertEquals(aSeatGroup.getSeat(3), aSeatGroup.getSeatByPosition(SeatPosition.AISLE_FORWARD));
assertEquals(rightSeatGroup.getSeat(0), rightSeatGroup.getSeatByPosition(SeatPosition.AISLE_BACKWARD));
assertEquals(rightSeatGroup.getSeat(1), rightSeatGroup.getSeatByPosition(SeatPosition.WINDOW_BACKWARD));
assertEquals(rightSeatGroup.getSeat(2), rightSeatGroup.getSeatByPosition(SeatPosition.AISLE_FORWARD));
assertEquals(rightSeatGroup.getSeat(3), rightSeatGroup.getSeatByPosition(SeatPosition.WINDOW_FORWARD));
}
private void testAvailableSeat(SeatGroup seatGroup, SeatSide side, int personSeatIndex, int expectedSeatIndex) { private void testAvailableSeat(SeatGroup seatGroup, SeatSide side, int personSeatIndex, int expectedSeatIndex) {
seatGroup.getSeat(personSeatIndex).setSittingPerson(aPerson); seatGroup.getSeat(personSeatIndex).setSittingPerson(aPerson);
assertEquals(seatGroup.getSeat(expectedSeatIndex), seatGroup.availableSeatAtSide(side)); assertEquals(seatGroup.getSeat(expectedSeatIndex), seatGroup.availableSeatAtSide(side));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment