diff --git a/res/Samples/Airports.txt b/res/Samples/Airports.txt index 74347c7..04fc09d 100644 --- a/res/Samples/Airports.txt +++ b/res/Samples/Airports.txt @@ -2030,7 +2030,7 @@ 2070,"Jubail","Jubail","Saudi Arabia","","OEJB",27.039028,49.405083,26,3,"U","Asia/Riyadh" 2071,"King Faisal Naval Base","Jeddah","Saudi Arabia","","OEJF",21.3481,39.173033,7,3,"U","Asia/Riyadh" 2072,"King Abdulaziz Intl","Jeddah","Saudi Arabia","JED","OEJN",21.679564,39.156536,48,3,"U","Asia/Riyadh" -2073,"King Khaled Military City","King Khalid Mil.city","Saudi Arabia","HBT","OEKK",27.900917,45.528194,1352,3,"U","Asia/Riyadh" +2073,"King Khaled Military City","King Khalid Mil.cityName","Saudi Arabia","HBT","OEKK",27.900917,45.528194,1352,3,"U","Asia/Riyadh" 2074,"Prince Mohammad Bin Abdulaziz","Madinah","Saudi Arabia","MED","OEMA",24.553422,39.705061,2151,3,"U","Asia/Riyadh" 2075,"Nejran","Nejran","Saudi Arabia","EAM","OENG",17.611436,44.419169,3982,3,"U","Asia/Riyadh" 2076,"Qaisumah","Hafr Al-batin","Saudi Arabia","AQI","OEPA",28.335192,46.125069,1174,3,"U","Asia/Riyadh" @@ -7874,7 +7874,7 @@ 9308,"Dawu","Lvliang","China","LLV",\N,37.683333,111.142778,3020,8,"N","Asia/Chongqing" 9309,"Delft Central","Delft","Netherlands","",\N,52.006667,4.356667,0,1,"E","Europe/Amsterdam" 9310,"Yading Daocheng","Daocheng","China","DCY","ZUDC",29.3231,100.0533,14472,8,"N","Asia/Chongqing" -9311,"Gannan","Xiahe city","China","GXH","ZLXH",34.4909,102.3719,10466,8,"N","Asia/Chongqing" +9311,"Gannan","Xiahe cityName","China","GXH","ZLXH",34.4909,102.3719,10466,8,"N","Asia/Chongqing" 9312,"Komandoo","Komandoo","Maldives","",\N,5.494003,73.424183,0,5,"N","Indian/Maldives" 9313,"Komandoo","Komandoo","Maldives","",\N,5.494003,73.424183,0,5,"N","Indian/Maldives" 9314,"Meck Island Airstrip","Meck Island","Marshall Islands","",\N,9,167.726944,10,12,"Z","Pacific/Majuro" diff --git a/src/main/java/seng202/group9/Controller/AirlineParser.java b/src/main/java/seng202/group9/Controller/AirlineParser.java index 4a354b9..88cf428 100644 --- a/src/main/java/seng202/group9/Controller/AirlineParser.java +++ b/src/main/java/seng202/group9/Controller/AirlineParser.java @@ -118,8 +118,8 @@ public class AirlineParser extends Parser { } } - return String.format("Entries Successfully Entered: %1$d.\n" + - "Entries With Errors: %2$d", successful, error); + return String.format("Airlines Successfully Entered: %1$d.\n" + + "Airlines With Errors: %2$d", successful, error); } public ArrayList getResult(){ diff --git a/src/main/java/seng202/group9/Controller/AirportParser.java b/src/main/java/seng202/group9/Controller/AirportParser.java index 04c1b15..b9cf410 100644 --- a/src/main/java/seng202/group9/Controller/AirportParser.java +++ b/src/main/java/seng202/group9/Controller/AirportParser.java @@ -169,8 +169,8 @@ public class AirportParser extends Parser { } } - return String.format("Entries Successfully Entered: %1$d.\n" + - "Entries With Errors: %2$d", successful, error); + return String.format("Airports Successfully Entered: %1$d.\n" + + "Airports With Errors: %2$d", successful, error); } public ArrayList getResult(){ diff --git a/src/main/java/seng202/group9/Controller/App.java b/src/main/java/seng202/group9/Controller/App.java index 2060de7..53f1e34 100644 --- a/src/main/java/seng202/group9/Controller/App.java +++ b/src/main/java/seng202/group9/Controller/App.java @@ -62,7 +62,7 @@ public class App extends Application e.printStackTrace(); } - +/* //testout single route adding try { currentDataset.addRoute("D2", "MAC", "WIN", "Y", "0", "NOW"); @@ -83,7 +83,6 @@ public class App extends Application e.printStackTrace(); } - //testing out airport parser try { System.out.println(currentDataset.importAirport("res/Samples/Airports.txt")); @@ -108,7 +107,7 @@ public class App extends Application System.out.println(currentDataset.importFlight("res/Samples/NZCH-WSSS.csv")); } catch (DataException e) { e.printStackTrace(); - } + }*/ } diff --git a/src/main/java/seng202/group9/Controller/Dataset.java b/src/main/java/seng202/group9/Controller/Dataset.java index 2225249..dd7c3dd 100644 --- a/src/main/java/seng202/group9/Controller/Dataset.java +++ b/src/main/java/seng202/group9/Controller/Dataset.java @@ -8,6 +8,7 @@ import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedHashMap; public class Dataset { @@ -389,13 +390,13 @@ public class Dataset { numOfDuplicates ++; }else{ //insert import into database - String airName = airlinesToImport.get(i).getName().replace("'", "''").replace("\"", "\"\""); - String airAlias = airlinesToImport.get(i).getAlias().replace("'", "''").replace("\"", "\"\""); - String airIATA = airlinesToImport.get(i).getIATA().replace("'", "''").replace("\"", "\"\""); - String airICAO = airlinesToImport.get(i).getICAO().replace("'", "''").replace("\"", "\"\""); - String airCallsign = airlinesToImport.get(i).getCallSign().replace("'", "''").replace("\"", "\"\""); - String airCountry = airlinesToImport.get(i).getCountry().replace("'", "''").replace("\"", "\"\""); - String airActive = airlinesToImport.get(i).getActive().replace("'", "''").replace("\"", "\"\""); + String airName = airlinesToImport.get(i).getName().replace("\"", "\"\""); + String airAlias = airlinesToImport.get(i).getAlias().replace("\"", "\"\""); + String airIATA = airlinesToImport.get(i).getIATA().replace("\"", "\"\""); + String airICAO = airlinesToImport.get(i).getICAO().replace("\"", "\"\""); + String airCallsign = airlinesToImport.get(i).getCallSign().replace("\"", "\"\""); + String airCountry = airlinesToImport.get(i).getCountryName().replace("\"", "\"\""); + String airActive = airlinesToImport.get(i).getActive().replace("\"", "\"\""); if (numOfAirlines > 0){ insertAirlineQuery += ","; } @@ -465,8 +466,8 @@ public class Dataset { } else { //airport variables String airpName = airportsToImport.get(i).getName().replace("\"", "\"\""); - String airpCity = airportsToImport.get(i).getCity().replace("\"", "\"\""); - String airpCountry = airportsToImport.get(i).getCountry().replace("\"", "\"\""); + String airpCity = airportsToImport.get(i).getCityName().replace("\"", "\"\""); + String airpCountry = airportsToImport.get(i).getCountryName().replace("\"", "\"\""); String airpIATA_FFA = airportsToImport.get(i).getIATA_FFA().replace("\"", "\"\""); String airpICAO = airportsToImport.get(i).getICAO().replace("\"", "\"\""); double airpLat = airportsToImport.get(i).getLatitude(); @@ -597,7 +598,7 @@ public class Dataset { numOfDuplicates ++; }else{ //route variables - String routeAirline = routesToImport.get(i).getAirline().replace("\"", "\"\""); + String routeAirline = routesToImport.get(i).getAirlineName().replace("\"", "\"\""); String routeSource = routesToImport.get(i).getDepartureAirport().replace("\"", "\"\""); String routeDestination = routesToImport.get(i).getArrivalAirport().replace("\"", "\"\""); String routeCode = routesToImport.get(i).getCode().replace("\"", "\"\""); @@ -733,7 +734,37 @@ public class Dataset { */ public void createDataLinks(){ - + //this may be seperated into more sepearate function in the future for time optimisation + //create Airline country link + for (Airline airline: airlines){ + airline.setCountry(countryDictionary.get(airline.getCountryName())); + } + //create Airport City and Country Link + HashMap airportsByIATA = new HashMap(); //this is used later for connecting the routes + HashMap airportsByICAO = new HashMap(); //this is used later for connecting the routes + for (Airport airport: airports){ + airportsByIATA.put(airport.getIATA_FFA(), airport); + airportsByICAO.put(airport.getICAO(), airport); + airport.setCountry(countryDictionary.get(airport.getCountryName())); + //TODO Add City in country (This is extra work). + airport.setCity(cityDictionary.get(airport.getCityName())); + airport.getCity().addAirport(airport); + } + //set Airport variables for route + for (Route route: routes){ + if (route.getDepartureAirport().length() > 3){ + route.setSourceAirport(airportsByICAO.get(route.getDepartureAirport())); + }else{ + route.setSourceAirport(airportsByIATA.get(route.getDepartureAirport())); + } + if (route.getArrivalAirport().length() > 3){ + route.setDestinationAirport(airportsByICAO.get(route.getArrivalAirport())); + }else{ + route.setDestinationAirport(airportsByIATA.get(route.getArrivalAirport())); + } + route.setAirline(airlineDictionary.get(route.getAirlineName())); + } + System.out.println("Links Made"); } /** @@ -777,7 +808,7 @@ public class Dataset { String insertAirlineQuery = "INSERT INTO `" + this.name + "_Airline` (`Name`, `Alias`, `IATA`, `ICAO`" + ", `Callsign`, `Country`, `Active`) VALUES (\""+airlineToAdd.getName()+"\", \"" + airlineToAdd.getAlias() + "\", " + "\"" + airlineToAdd.getIATA() + "\", \"" + airlineToAdd.getICAO() + "\", \"" + airlineToAdd.getCallSign() + "\", " + - "\"" + airlineToAdd.getCountry() + "\", \"" + airlineToAdd.getActive() + "\");"; + "\"" + airlineToAdd.getCountryName() + "\", \"" + airlineToAdd.getActive() + "\");"; stmt.execute(insertAirlineQuery); //get the airline id stmt = c.createStatement(); @@ -834,8 +865,8 @@ public class Dataset { //add the airport stmt = c.createStatement(); String insertAirportQuery = "INSERT INTO `" + this.name + "_Airport` (`Name`, `City`, `Country`, `IATA/FFA`, " + - "`ICAO`, `Latitude`, `Longitude`, `Altitude`) VALUES (\""+airportToAdd.getName()+"\", \""+airportToAdd.getCity()+"\", " + - "\""+airportToAdd.getCountry()+"\", \""+airportToAdd.getIATA_FFA()+"\", \""+airportToAdd.getICAO()+"\", " + + "`ICAO`, `Latitude`, `Longitude`, `Altitude`) VALUES (\""+airportToAdd.getName()+"\", \""+airportToAdd.getCityName()+"\", " + + "\""+airportToAdd.getCountryName()+"\", \""+airportToAdd.getIATA_FFA()+"\", \""+airportToAdd.getICAO()+"\", " + ""+airportToAdd.getLatitude()+", "+airportToAdd.getLongitude()+", "+airportToAdd.getAltitude()+");"; stmt.execute(insertAirportQuery); //get the airport id @@ -929,7 +960,7 @@ public class Dataset { } public void addRoute(Route routeToAdd) throws DataException{ - if (routeToAdd.getAirline().length() != 2 && routeToAdd.getAirline().length() != 3){ + if (routeToAdd.getAirlineName().length() != 2 && routeToAdd.getAirlineName().length() != 3){ throw new DataException("Airline ICAO code must be 2 or 3 letters."); } if (routeToAdd.getDepartureAirport().length() != 3 && routeToAdd.getDepartureAirport().length() != 4){ @@ -953,7 +984,7 @@ public class Dataset { c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); //add the airline stmt = c.createStatement(); - String airline = routeToAdd.getAirline().replace("\"", "\"\""); + String airline = routeToAdd.getAirlineName().replace("\"", "\"\""); String sourceAir = routeToAdd.getDepartureAirport().replace("\"", "\"\""); String destAir = routeToAdd.getArrivalAirport().replace("\"", "\"\""); String equipment = routeToAdd.getEquipment().replace("\"", "\"\""); diff --git a/src/main/java/seng202/group9/Controller/FlightPathParser.java b/src/main/java/seng202/group9/Controller/FlightPathParser.java index 8040d15..7766e69 100644 --- a/src/main/java/seng202/group9/Controller/FlightPathParser.java +++ b/src/main/java/seng202/group9/Controller/FlightPathParser.java @@ -147,8 +147,8 @@ public class FlightPathParser extends Parser { } } - return String.format("Entries Successfully Entered: %1$d.\n" + - "Entries With Errors: %2$d", successful, error); + return String.format("Flight Points Successfully Entered: %1$d.\n" + + "Flight Points With Errors: %2$d", successful, error); } public ArrayList getResult(){ diff --git a/src/main/java/seng202/group9/Controller/RouteParser.java b/src/main/java/seng202/group9/Controller/RouteParser.java index b536276..e27db6f 100644 --- a/src/main/java/seng202/group9/Controller/RouteParser.java +++ b/src/main/java/seng202/group9/Controller/RouteParser.java @@ -149,8 +149,8 @@ public class RouteParser extends Parser { } } - return String.format("Entries Successfully Entered: %1$d.\n" + - "Entries With Errors: %2$d", successful, error); + return String.format("Routes Successfully Entered: %1$d.\n" + + "Routes With Errors: %2$d", successful, error); } public ArrayList getResult(){ diff --git a/src/main/java/seng202/group9/Core/Airline.java b/src/main/java/seng202/group9/Core/Airline.java index 54ebc8d..64ce272 100644 --- a/src/main/java/seng202/group9/Core/Airline.java +++ b/src/main/java/seng202/group9/Core/Airline.java @@ -17,9 +17,10 @@ public class Airline { private String alias; private String callSign; private String active; - private String country; + private String countryName; private ArrayList routes; - + private Country country = null; + /** * Constructor * @@ -29,10 +30,10 @@ public class Airline { * @param IATA * @param ICAO * @param callSign - * @param country + * @param countryName * @param active */ - public Airline(int ID, String name, String alias, String IATA, String ICAO, String callSign, String country, String active){ + public Airline(int ID, String name, String alias, String IATA, String ICAO, String callSign, String countryName, String active){ this.ID = ID; this.IATA = IATA; this.ICAO = ICAO; @@ -40,12 +41,12 @@ public class Airline { this.alias = alias; this.callSign = callSign; this.active = active; - this.country = country; + this.countryName = countryName; this.routes = new ArrayList(); } - public Airline(String name, String alias, String IATA, String ICAO, String callSign, String country, String active){ + public Airline(String name, String alias, String IATA, String ICAO, String callSign, String countryName, String active){ this.ID = -1; this.IATA = IATA; this.ICAO = ICAO; @@ -53,7 +54,7 @@ public class Airline { this.alias = alias; this.callSign = callSign; this.active = active; - this.country = country; + this.countryName = countryName; this.routes = new ArrayList(); } /** @@ -109,10 +110,10 @@ public class Airline { } /** * Changes Country the Airline belongs to - * @param country + * @param countryName */ - public void setCountry(String country) { - this.country = country; + public void setCountryName(String countryName) { + this.countryName = countryName; } /** * Sets routes to the airline @@ -181,12 +182,28 @@ public class Airline { return active; } /** - * get the country the airline belongs to + * get the countryName the airline belongs to * @return */ - public String getCountry(){ + public String getCountryName(){ + return countryName; + } + + /** + * gets the Country class that this airline belongs to + * @return + */ + public Country getCountry() { return country; } + + /** + * sets the country class this airline belongs to + * @param country + */ + public void setCountry(Country country) { + this.country = country; + } /** * get routes the airline flies * @return diff --git a/src/main/java/seng202/group9/Core/Airport.java b/src/main/java/seng202/group9/Core/Airport.java index 64c5d31..a21043b 100644 --- a/src/main/java/seng202/group9/Core/Airport.java +++ b/src/main/java/seng202/group9/Core/Airport.java @@ -16,8 +16,10 @@ public class Airport { private double altitude; private double longitude; private double latitude; - private String city; - private String country; + private String cityName; + private City city; + private String countryName; + private Country country; private ArrayList departureRoutes = new ArrayList(); private ArrayList arrivalRoutes = new ArrayList(); @@ -25,14 +27,15 @@ public class Airport { * Constructor * @param ID from the database * @param name Name of the airport - * @param city city of the airport + * @param cityName cityName of the airport + * @param countryName name of Country the airport belongs to * @param IATA_FFA * @param ICAO * @param altitude * @param longitude * @param latitude */ - public Airport(int ID, String name, String city, String country, String IATA_FFA, String ICAO, double latitude, double longitude + public Airport(int ID, String name, String cityName, String countryName, String IATA_FFA, String ICAO, double latitude, double longitude , double altitude){ this.ID = ID; this.name = name; @@ -41,19 +44,19 @@ public class Airport { this.altitude = altitude; this.longitude = longitude; this.latitude = latitude; - this.city = city; - this.country = country; + this.cityName = cityName; + this.countryName = countryName; } /** * Secondary Constructor the ID needs to be set after. - * @param city City of airport + * @param cityName City of airport * @param IATA_FFA * @param ICAO * @param altitude * @param longitude * @param latitude */ - public Airport(String name, String city, String country, String IATA_FFA, String ICAO, double latitude, double longitude + public Airport(String name, String cityName, String countryName, String IATA_FFA, String ICAO, double latitude, double longitude , double altitude){ this.ID = -1; this.name = name; @@ -62,8 +65,8 @@ public class Airport { this.altitude = altitude; this.longitude = longitude; this.latitude = latitude; - this.city = city; - this.country = country; + this.cityName = cityName; + this.countryName = countryName; } /** * returns the IATA/FFA code @@ -127,11 +130,11 @@ public class Airport { this.longitude = longitude; } /** - * sets the city of the airport (which city it is in) - * @param city + * sets the cityName of the airport (which cityName it is in) + * @param cityName */ - public void setCity(String city) { - this.city = city; + public void setCityName(String cityName) { + this.cityName = cityName; } /** * set the routes that depart from it @@ -145,12 +148,12 @@ public class Airport { } } - public String getCountry() { - return country; + public String getCountryName() { + return countryName; } - public void setCountry(String country) { - this.country = country; + public void setCountryName(String countryName) { + this.countryName = countryName; } /** @@ -220,12 +223,44 @@ public class Airport { return latitude; } /** - * gets the city the airport is located in + * gets the cityName the airport is located in * @return City of Airport */ - public String getCity(){ + public String getCityName(){ + return cityName; + } + + /** + * gets the city class asssociated wit hthis airport + * @return + */ + public City getCity() { return city; } + + /** + * sets the city class associated with this airport + * @param city + */ + public void setCity(City city) { + this.city = city; + } + + /** + * get country class associated with this airport + * @return + */ + public Country getCountry() { + return country; + } + + /** + * set country class associated with this airport + * @param country + */ + public void setCountry(Country country) { + this.country = country; + } /** * gets the routes that depart from this airport * @return Routes Departing from Airport @@ -321,7 +356,7 @@ public class Airport { @Override public String toString(){ - return this.city+" Airport has ICAO: "+this.ICAO+", IATA/FFA: "+this.IATA_FFA+" and is located at ("+this.latitude+", "+this.longitude + return this.cityName +" Airport has ICAO: "+this.ICAO+", IATA/FFA: "+this.IATA_FFA+" and is located at ("+this.latitude+", "+this.longitude + ").\n It has "+this.departureRoutes.size()+" departing routes and "+this.arrivalRoutes.size()+" arriving routes."; } } diff --git a/src/main/java/seng202/group9/Core/Route.java b/src/main/java/seng202/group9/Core/Route.java index 217269a..c193abf 100644 --- a/src/main/java/seng202/group9/Core/Route.java +++ b/src/main/java/seng202/group9/Core/Route.java @@ -8,16 +8,20 @@ import seng202.group9.Controller.DataException; * */ public class Route { - private int ID;//this ID is the route id not the airline or airports. + private int ID;//this ID is the route id not the airlineName or airports. private int stops; private String codeShare; private String equipment; - private String airline; + private String airlineName; private String departureAirport; private String arrivalAirport; + private Airport sourceAirport; + private Airport destinationAirport; + private Airline airline = null; + /** * Constructor for pulling from database - * @param airline + * @param airlineName * @param ID * @param departureAirport * @param arrivalAirport @@ -25,34 +29,34 @@ public class Route { * @param stops * @param equipment */ - public Route(int ID, String airline, String departureAirport, String arrivalAirport, - String codeShare, int stops, String equipment){ + public Route(int ID, String airlineName, String departureAirport, String arrivalAirport, + String codeShare, int stops, String equipment){ this.ID = ID; this.stops = stops; this.codeShare = codeShare; this.equipment = equipment; - this.airline = airline; + this.airlineName = airlineName; this.departureAirport = departureAirport; this.arrivalAirport = arrivalAirport; } /** * Constructor for adding - * @param airline + * @param airlineName * @param departureAirport * @param arrivalAirport * @param codeShare * @param stops * @param equipment */ - public Route(String airline, String departureAirport, String arrivalAirport, - String codeShare, int stops, String equipment){ + public Route(String airlineName, String departureAirport, String arrivalAirport, + String codeShare, int stops, String equipment){ //remember to set the id manually later after adding it to the database and grab //the new id value of the route. this.ID = -1; this.stops = stops; this.codeShare = codeShare; this.equipment = equipment; - this.airline = airline; + this.airlineName = airlineName; this.departureAirport = departureAirport; this.arrivalAirport = arrivalAirport; } @@ -99,11 +103,11 @@ public class Route { this.equipment = equipment; } /** - * sets airline that flies this route - * @param airline + * sets airlineName that flies this route + * @param airlineName */ - public void setAirline(String airline) { - this.airline = airline; + public void setAirlineName(String airlineName) { + this.airlineName = airlineName; } /** * returns the id of this route @@ -138,11 +142,11 @@ public class Route { return equipment; } /** - * returns the airline that flies this route + * returns the airlineName that flies this route * @return */ - public String getAirline(){ - return airline; + public String getAirlineName(){ + return airlineName; } /** * returns the source airport of this route @@ -159,6 +163,53 @@ public class Route { return arrivalAirport; } + /** + * get Airport class that is bound with the destination of the airport + * @return + */ + public Airport getDestinationAirport() { + return destinationAirport; + } + + /** + * set Airport class that is bound with the destination of the airport + * @param destinationAirport + */ + public void setDestinationAirport(Airport destinationAirport) { + this.destinationAirport = destinationAirport; + } + + /** + * get Airport class that is bound with the source airport + * @return + */ + public Airport getSourceAirport() { + return sourceAirport; + } + + /** + * set Airport class that is bound with the source airport + * @param sourceAirport + */ + public void setSourceAirport(Airport sourceAirport) { + this.sourceAirport = sourceAirport; + } + + /** + * gets Airline clas that is bound to the Airline that flights this route. + * @return + */ + public Airline getAirline() { + return airline; + } + + /** + * sets Airline clas that is bound to the Airline that flights this route. + * @return + */ + public void setAirline(Airline airline) { + this.airline = airline; + } /** * Checks is passed route is a duplicate of the current one if so it throws an DataException */ @@ -173,7 +224,7 @@ public class Route { @Override public String toString(){ - return airline+" flies from "+departureAirport+" to "+arrivalAirport+" on a "+equipment +" stopping "+stops+" amount of times"; + return airlineName +" flies from "+departureAirport+" to "+arrivalAirport+" on a "+equipment +" stopping "+stops+" amount of times"; } } diff --git a/src/test/java/seng202/group9/AirlineTest.java b/src/test/java/seng202/group9/AirlineTest.java index 8f5a82a..7afef28 100644 --- a/src/test/java/seng202/group9/AirlineTest.java +++ b/src/test/java/seng202/group9/AirlineTest.java @@ -56,7 +56,7 @@ public class AirlineTest extends TestCase { assertTrue(allNipponAirways.getIATA() == "NH");// test iata assertTrue(allNipponAirways.getICAO() == "ANA");// test icao assertTrue(allNipponAirways.getCallSign() == "ALL NIPPON");// test call sign - assertTrue(allNipponAirways.getCountry() == "Japan");// test country + assertTrue(allNipponAirways.getCountryName() == "Japan");// test country assertTrue(allNipponAirways.getActive() == "Y");// get active //check set allNipponAirways.setID(322);//ID @@ -81,8 +81,8 @@ public class AirlineTest extends TestCase { allNipponAirways.setCallSign("NIKE RULES");//Call Sign assertTrue(allNipponAirways.getCallSign() =="NIKE RULES"); - allNipponAirways.setCountry("Nikeland");//Country - assertTrue(allNipponAirways.getCountry() == "Nikeland"); + allNipponAirways.setCountryName("Nikeland");//Country + assertTrue(allNipponAirways.getCountryName() == "Nikeland"); allNipponAirways.setActive("N");//Active assertTrue(allNipponAirways.getActive() == "N"); diff --git a/src/test/java/seng202/group9/AirportUnitTest.java b/src/test/java/seng202/group9/AirportUnitTest.java index dd45eba..6d3e379 100644 --- a/src/test/java/seng202/group9/AirportUnitTest.java +++ b/src/test/java/seng202/group9/AirportUnitTest.java @@ -34,7 +34,7 @@ public class AirportUnitTest { fail("No Exception should be thrown by the constructor where the ID is already set bye trying to get the ID."); } assertEquals(heathrow.getName(), "Heathrow"); - assertEquals(heathrow.getCity(), "London");//check city + assertEquals(heathrow.getCityName(), "London");//check city assertEquals(heathrow.getIATA_FFA(), "LHR");//check IATA/FFA assertEquals(heathrow.getICAO(), "EGLL");//check ICAO assertTrue(heathrow.getLatitude() == 51.4775);//check latitude @@ -51,8 +51,8 @@ public class AirportUnitTest { } heathrow.setName("Hearthstone");//check name assertEquals(heathrow.getName(), "Hearthstone"); - heathrow.setCity("Blizzard Servers");//check city - assertEquals(heathrow.getCity(), "Blizzard Servers"); + heathrow.setCityName("Blizzard Servers");//check city + assertEquals(heathrow.getCityName(), "Blizzard Servers"); heathrow.setIATA_FFA("HTS");//test set IATA/FFA assertEquals(heathrow.getIATA_FFA(), "HTS"); heathrow.setICAO("BLIZ");// test set ICAO diff --git a/src/test/java/seng202/group9/RouteTest.java b/src/test/java/seng202/group9/RouteTest.java index da17f9c..1dc9cbc 100644 --- a/src/test/java/seng202/group9/RouteTest.java +++ b/src/test/java/seng202/group9/RouteTest.java @@ -30,21 +30,22 @@ public class RouteTest extends TestCase { assertEquals(route.getAirline(), "BA"); assertEquals(route.getDepartureAirport(), "SIN"); assertEquals(route.getArrivalAirport(), "LHR"); + assertEquals(route.getAirlineName(), "BA"); assertEquals(route.getCode(), ""); assertEquals(route.getEquipment(), "744 777"); /////////////// //test setters /////////////// - route.setAirline("BAH"); + route.setAirlineName("BAH"); route.setArrivalAirport("LEFT-HAND-RULE"); route.setDepartureAirport("SING-SONG"); route.setCode("Y"); route.setStops(5); route.setEquipment("747 840"); - assertEquals(route.getAirline(), "BAH"); assertEquals(route.getDepartureAirport(), "SING-SONG"); assertEquals(route.getArrivalAirport(), "LEFT-HAND-RULE"); + assertEquals(route.getAirlineName(), "BAH"); assertEquals(route.getCode(), "Y"); assertEquals(route.getEquipment(), "747 840"); ////////////////////////////