Added Unit tests to Airline (Missing Add, Set and Get routes)

This commit is contained in:
YaFedImYaEatIm
2016-08-15 22:54:13 +12:00
parent 8d6c1badcb
commit 215e626afc
3 changed files with 93 additions and 50 deletions
@@ -0,0 +1,89 @@
package seng202.group9;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import seng202.group9.Core.Airline;
/**
* Test the functions for the Airline
* this is the get, set methods for in the class Airline
* Airline
* @author Fan-Wu Yang
*
*/
public class AirlineTest extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
public AirlineTest(String testName){
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AirlineTest.class );
}
/**
* Test for Airline get and setting methods
* (Currently missing ADD ROUTES)
*/
public void testAirlineGetSet(){
//ID, Name, Alias, IATA, ICAO, CallSign, Country, Active
//324,"All Nippon Airways","ANA All Nippon Airways","NH","ANA","ALL NIPPON","Japan","Y"
Airline allNipponAirways = new Airline(324, "All Nippon Airways", "ANA All Nippon Airways",
"NH", "ANA", "ALL NIPPON", "Japan", "Y");
//check constructor
assertTrue(allNipponAirways.getID() == 324);
assertTrue(allNipponAirways.getName() == "All Nippon Airways");
assertTrue(allNipponAirways.getAlias() == "ANA All Nippon Airways");
assertTrue(allNipponAirways.getIATA() == "NH");
assertTrue(allNipponAirways.getICAO() == "ANA");
assertTrue(allNipponAirways.getCallSign() == "ALL NIPPON");
assertTrue(allNipponAirways.getCountry() == "Japan");
assertTrue(allNipponAirways.getActive() == "Y");
//check set
allNipponAirways.setID(322);//ID
assertTrue(allNipponAirways.getID() == 322);
allNipponAirways.setName("All Nike Airways");//Name
assertTrue(allNipponAirways.getName() == "All Nike Airways");
allNipponAirways.setAlias("ANA All Nike Airways");//Alias
assertTrue(allNipponAirways.getAlias() == "ANA All Nike Airways");
allNipponAirways.setIATA("NA");//IATA
assertTrue(allNipponAirways.getIATA() == "NA");
allNipponAirways.setICAO("ANNA");//ICAO
assertTrue(allNipponAirways.getICAO() == "ANNA");
allNipponAirways.setCallSign("NIKE RULES");//Call Sign
assertTrue(allNipponAirways.getCallSign() =="NIKE RULES");
allNipponAirways.setCountry("Nikeland");//Country
assertTrue(allNipponAirways.getCountry() == "Nikeland");
allNipponAirways.setActive("N");//Active
assertTrue(allNipponAirways.getActive() == "N");
//TODO Add Route adding setting and getting.
}
public void testToString(){
//ID, Name, Alias, IATA, ICAO, CallSign, Country, Active
//324,"All Nippon Airways","ANA All Nippon Airways","NH","ANA","ALL NIPPON","Japan","Y"
Airline allNipponAirways = new Airline(324, "All Nippon Airways", "ANA All Nippon Airways",
"NH", "ANA", "ALL NIPPON", "Japan", "Y");
assertTrue(allNipponAirways.toString() == "All Nippon Airways");
assertEquals(allNipponAirways + "" ,"All Nippon Airways");
}
}
@@ -1,46 +0,0 @@
package seng202.group9;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Test the functions inside the COre package to make sure all their functions are working correctly
* Core package is located at seng202.group9.Core
* The Core package has 7 classes needed to be tested.
* Airline
* Airport
* City
* FlightPath
* FlightPoint
* Route
* @author Fan-Wu Yang
*
*/
public class CorePackageTest extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
public CorePackageTest(String testName){
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Test for Airline
*/
public void testAirline(){
}
}