mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
0b3ebf229f
- Mark is an abstract class which containing its name and type - Single Mark is a sub class of Mark which containing only one GPS location - Gate Mark is a sub class of Mark which containing two Single Marks #refactor #fix #story[10] #story[11] #story[12]
55 lines
1.3 KiB
Java
55 lines
1.3 KiB
Java
package seng302;
|
|
|
|
import org.junit.Test;
|
|
import seng302.models.Leg;
|
|
import seng302.models.mark.SingleMark;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
/**
|
|
* Unit test for the Leg class.
|
|
*/
|
|
public class LegTest {
|
|
|
|
/**
|
|
* Test creation of the leg by specifying a string
|
|
* for the marker label
|
|
*/
|
|
@Test
|
|
public void testLegCreationUsingMarkerLabel() {
|
|
Leg leg = new Leg(010, 100, "SingleMark");
|
|
|
|
assertEquals(leg.getHeading(), 010);
|
|
assertEquals(leg.getDistance(), 100);
|
|
assertEquals(leg.getMarkerLabel(), "SingleMark");
|
|
assertEquals(leg.getIsFinishingLeg(), false);
|
|
}
|
|
|
|
/**
|
|
* Test creation of the leg by providing a
|
|
* SingleMark object
|
|
*/
|
|
@Test
|
|
public void testLegCreation() {
|
|
Leg leg = new Leg(010, 100, new SingleMark("SingleMark"));
|
|
|
|
assertEquals(leg.getHeading(), 010);
|
|
assertEquals(leg.getDistance(), 100);
|
|
assertEquals(leg.getMarkerLabel(), "SingleMark");
|
|
assertEquals(leg.getIsFinishingLeg(), false);
|
|
}
|
|
|
|
/**
|
|
* Test changing whether or not a
|
|
* leg is the finishing leg
|
|
*/
|
|
@Test
|
|
public void testSetFinishLeg() {
|
|
Leg leg = new Leg(010, 100, "SingleMark");
|
|
|
|
leg.setFinishingLeg(true);
|
|
assertEquals(leg.getIsFinishingLeg(), true);
|
|
}
|
|
|
|
}
|