mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added tests for the Race class
- Added a test to ensure all boats entered into the race also finish it - #test
This commit is contained in:
@@ -9,6 +9,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
*/
|
*/
|
||||||
public class BoatTest
|
public class BoatTest
|
||||||
{
|
{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBoatCreation()
|
public void testBoatCreation()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ import java.lang.reflect.Array;
|
|||||||
*/
|
*/
|
||||||
public class RaceTest
|
public class RaceTest
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Test that all boats that were added to the race also finish the race
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAddingBoatsToRace()
|
public void testFinishingBoats()
|
||||||
{
|
{
|
||||||
Boat boat1 = new Boat("Team 1");
|
Boat boat1 = new Boat("Team 1");
|
||||||
Boat boat2 = new Boat("Team 2");
|
Boat boat2 = new Boat("Team 2");
|
||||||
@@ -24,4 +27,19 @@ public class RaceTest
|
|||||||
|
|
||||||
assertEquals(Array.getLength(race.getFinishedBoats()), 3);
|
assertEquals(Array.getLength(race.getFinishedBoats()), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Test that all boats were added to the race
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testAddingBoatsToRace(){
|
||||||
|
Boat boat1 = new Boat("Team 1");
|
||||||
|
Boat boat2 = new Boat("Team 2");
|
||||||
|
|
||||||
|
Race race = new Race();
|
||||||
|
race.addBoat(boat1);
|
||||||
|
race.addBoat(boat2);
|
||||||
|
|
||||||
|
assertEquals(Array.getLength(boats.getBoats()), 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user