Allow collision checking to provide collision parameters to ray casting method

- Added tests for MockBoat collision direction and distance

#story[1100]
This commit is contained in:
cbt24
2017-08-15 13:47:59 +12:00
parent 2fbb96afd7
commit 7d64a43350
5 changed files with 70 additions and 15 deletions
@@ -1,7 +1,37 @@
package mock.model;
import mock.model.collider.Collision;
import org.junit.Before;
import org.junit.Test;
import shared.model.Bearing;
import shared.model.CompoundMark;
import shared.model.GPSCoordinate;
import shared.model.Mark;
import static org.junit.Assert.*;
public class MockBoatTest {
//TODO
private MockBoat boat;
private CompoundMark ahead;
private CompoundMark behind;
@Before
public void setUp() {
boat = new MockBoat(0, "Bob", "NZ", null);
boat.setCurrentPosition(new GPSCoordinate(0,0));
boat.setBearing(Bearing.fromDegrees(180));
ahead = new CompoundMark(0, "Ahead", new Mark(0, "Ahead", new GPSCoordinate(-.0001, 0)));
behind = new CompoundMark(1, "Behind", new Mark(0, "Behind", new GPSCoordinate(.0001, 0)));
}
@Test
public void markAheadOfBoat0() {
assertTrue(ahead.rayCast(boat, new Collision(Bearing.fromDegrees(0), 100)));
}
@Test
public void markBehindBoat180() {
assertTrue(behind.rayCast(boat, new Collision(Bearing.fromDegrees(180), 100)));
}
}