mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Reformatted doctring and import statements
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
{
|
||||
public class AppTest {
|
||||
@Test
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
public void testApp() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for the Team class.
|
||||
*/
|
||||
public class BoatTest
|
||||
{
|
||||
public class BoatTest {
|
||||
|
||||
@Test
|
||||
public void testBoatCreation()
|
||||
{
|
||||
public void testBoatCreation() {
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
assertEquals(boat1.getTeamName(), "Team 1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangeTeamName()
|
||||
{
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
boat1.setTeamName("Team 2");
|
||||
assertEquals(boat1.getTeamName(), "Team 2");
|
||||
public void testChangeTeamName() {
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
boat1.setTeamName("Team 2");
|
||||
assertEquals(boat1.getTeamName(), "Team 2");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Test for Event class
|
||||
@@ -11,11 +10,11 @@ import static org.junit.Assert.*;
|
||||
*/
|
||||
public class EventTest {
|
||||
|
||||
@Test
|
||||
public void getTimeString() throws Exception {
|
||||
Leg leg = new Leg(035, 100, "Start");
|
||||
Boat boat = new Boat("testBoat");
|
||||
Event event = new Event(1231242, boat, leg);
|
||||
assertEquals("20:31:242", event.getTimeString());
|
||||
}
|
||||
@Test
|
||||
public void getTimeString() throws Exception {
|
||||
Leg leg = new Leg(035, 100, "Start");
|
||||
Boat boat = new Boat("testBoat");
|
||||
Event event = new Event(1231242, boat, leg);
|
||||
assertEquals("20:31:242", event.getTimeString());
|
||||
}
|
||||
}
|
||||
@@ -3,50 +3,50 @@ package seng302;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/** Unit test for FileParser class
|
||||
/**
|
||||
* Unit test for FileParser class
|
||||
* Created by Haoming on 5/03/17.
|
||||
*/
|
||||
public class FileParserTest {
|
||||
|
||||
/*
|
||||
test if it fails from reading non existed file
|
||||
*/
|
||||
@Test (expected = FileNotFoundException.class)
|
||||
public void readNonExistedFile() throws Exception {
|
||||
FileParser fileParser = new FileParser("test/java/seng302/non-existed.json");
|
||||
}
|
||||
/*
|
||||
test if it fails from reading non existed file
|
||||
*/
|
||||
@Test(expected = FileNotFoundException.class)
|
||||
public void readNonExistedFile() throws Exception {
|
||||
FileParser fileParser = new FileParser("test/java/seng302/non-existed.json");
|
||||
}
|
||||
|
||||
/*
|
||||
test a valid json file with valid content.
|
||||
*/
|
||||
@Test
|
||||
public void readValidFile() throws Exception{
|
||||
FileParser fileParser = new FileParser("src/test/java/seng302/valid.json");
|
||||
/*
|
||||
test a valid json file with valid content.
|
||||
*/
|
||||
@Test
|
||||
public void readValidFile() throws Exception {
|
||||
FileParser fileParser = new FileParser("src/test/java/seng302/valid.json");
|
||||
|
||||
assertEquals("AC35", fileParser.getRaceName());
|
||||
assertEquals("AC35", fileParser.getRaceName());
|
||||
|
||||
assertEquals("Oracle Team USA", fileParser.getTeams().get(0).get("team-name"));
|
||||
assertEquals(20.9, fileParser.getTeams().get(0).get("velocity"));
|
||||
assertEquals(2, fileParser.getRaceSize());
|
||||
assertEquals(6, fileParser.getTotalNumberOfTeams());
|
||||
}
|
||||
assertEquals("Oracle Team USA", fileParser.getTeams().get(0).get("team-name"));
|
||||
assertEquals(20.9, fileParser.getTeams().get(0).get("velocity"));
|
||||
assertEquals(2, fileParser.getRaceSize());
|
||||
assertEquals(6, fileParser.getTotalNumberOfTeams());
|
||||
}
|
||||
|
||||
/*
|
||||
test an invalid json file within wrong type value and misnamed
|
||||
variable name.
|
||||
*/
|
||||
@Test
|
||||
public void readInvalidFile() throws Exception {
|
||||
FileParser fileParser = new FileParser("src/test/java/seng302/invalid.json");
|
||||
/*
|
||||
test an invalid json file within wrong type value and misnamed
|
||||
variable name.
|
||||
*/
|
||||
@Test
|
||||
public void readInvalidFile() throws Exception {
|
||||
FileParser fileParser = new FileParser("src/test/java/seng302/invalid.json");
|
||||
|
||||
assertEquals(null, fileParser.getRaceName());
|
||||
assertEquals(null, fileParser.getTeams());
|
||||
//assertEquals(-1, fileParser.getTimeScale());
|
||||
assertEquals(null,fileParser.getTeams());
|
||||
}
|
||||
assertEquals(null, fileParser.getRaceName());
|
||||
assertEquals(null, fileParser.getTeams());
|
||||
//assertEquals(-1, fileParser.getTimeScale());
|
||||
assertEquals(null, fileParser.getTeams());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for the Leg class.
|
||||
*/
|
||||
public class LegTest{
|
||||
public class LegTest {
|
||||
|
||||
/*
|
||||
Test creation of the leg by specifying a string
|
||||
for the marker label
|
||||
*/
|
||||
@Test
|
||||
public void testLegCreationUsingMarkerLabel()
|
||||
{
|
||||
/*
|
||||
Test creation of the leg by specifying a string
|
||||
for the marker label
|
||||
*/
|
||||
@Test
|
||||
public void testLegCreationUsingMarkerLabel() {
|
||||
Leg leg = new Leg(010, 100, "Marker");
|
||||
|
||||
assertEquals(leg.getHeading(), 010);
|
||||
@@ -25,12 +24,11 @@ public class LegTest{
|
||||
}
|
||||
|
||||
/*
|
||||
Test creation of the leg by providing a
|
||||
Test creation of the leg by providing a
|
||||
Marker object
|
||||
*/
|
||||
@Test
|
||||
public void testLegCreation()
|
||||
{
|
||||
public void testLegCreation() {
|
||||
Leg leg = new Leg(010, 100, new Marker("Marker"));
|
||||
|
||||
assertEquals(leg.getHeading(), 010);
|
||||
@@ -40,12 +38,11 @@ public class LegTest{
|
||||
}
|
||||
|
||||
/*
|
||||
Test changing whether or not a
|
||||
Test changing whether or not a
|
||||
leg is the finishing leg
|
||||
*/
|
||||
@Test
|
||||
public void testSetFinishLeg()
|
||||
{
|
||||
public void testSetFinishLeg() {
|
||||
Leg leg = new Leg(010, 100, "Marker");
|
||||
|
||||
leg.setFinishingLeg(true);
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for the Race class.
|
||||
*/
|
||||
public class RaceTest
|
||||
{
|
||||
/*
|
||||
Test that all boats were added to the race
|
||||
*/
|
||||
public class RaceTest {
|
||||
/**
|
||||
* Test that all boats were added to the race
|
||||
*/
|
||||
@Test
|
||||
public void testAddingBoatsToRace(){
|
||||
public void testAddingBoatsToRace() {
|
||||
Boat boat1 = new Boat("Team 1");
|
||||
Boat boat2 = new Boat("Team 2");
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"time-scale": "abc",
|
||||
"race-name": 123,
|
||||
"teams-with-wrong-name":["team1","team2","team3"]
|
||||
"teams-with-wrong-name": [
|
||||
"team1",
|
||||
"team2",
|
||||
"team3"
|
||||
]
|
||||
}
|
||||
@@ -3,11 +3,29 @@
|
||||
"time-scale": 1,
|
||||
"race-size": 2,
|
||||
"teams": [
|
||||
{"team-name": "Oracle Team USA", "velocity": 20.9},
|
||||
{"team-name": "Artemis Racing", "velocity": 18.3},
|
||||
{"team-name": "Emirates Team New Zealand", "velocity": 21.5},
|
||||
{"team-name": "Groupama Team France","velocity": 19.9},
|
||||
{"team-name": "Land Rover BAR", "velocity": 17.6},
|
||||
{"team-name": "SoftBank Team Japan", "velocity": 16.6}
|
||||
{
|
||||
"team-name": "Oracle Team USA",
|
||||
"velocity": 20.9
|
||||
},
|
||||
{
|
||||
"team-name": "Artemis Racing",
|
||||
"velocity": 18.3
|
||||
},
|
||||
{
|
||||
"team-name": "Emirates Team New Zealand",
|
||||
"velocity": 21.5
|
||||
},
|
||||
{
|
||||
"team-name": "Groupama Team France",
|
||||
"velocity": 19.9
|
||||
},
|
||||
{
|
||||
"team-name": "Land Rover BAR",
|
||||
"velocity": 17.6
|
||||
},
|
||||
{
|
||||
"team-name": "SoftBank Team Japan",
|
||||
"velocity": 16.6
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user