SYSC 2004 Lecture Notes - Lecture 3: Test Fixture, Default Constructor
Document Summary
* @version 1. 2 may 1st, 2015 public class cartest extends junit. framework. testcase. * default constructor for test class cartest public cartest() * called before every test case method. protected void setup() * called after every test case method. protected void teardown() public void testcreatebusinesscar() /* verify that the car has the right number of seats. assertequals(car. business_seats, seats. length); /* verify that each seat has the correct number and price. for (int i = 0; i < seats. length; i++) { assertequals(i+1, seats[i]. number()); assertequals(car. business_seat_cost, seats[i]. price()); public void testcreateeconomycar() /* verify that the car has the right number of seats. assertequals(car. economy_seats, seats. length); /* verify that each seat has the correct number and price. for (int i = 0; i < seats. length; i++) { assertequals(i+1, seats[i]. number()); assertequals(car. economy_seat_cost, seats[i]. price()); public void testid() Car acar; acar= new car(1385, true); assertequals(1385, acar. id()); acar = new car(1400, false); assertequals(1400, acar. id()); public void testisbusinessclass() Car acar; acar = new car(1385, true); asserttrue(acar. isbusinessclass()); acar = new car(1400, false); assertfalse(acar. isbusinessclass()); public void testbooknextseat()