@Test public void test() { rentalcompany.addCar(car1); rentalcompany.addCar(car2); int testmethod = rentalcompany.terminateRental(drivinglicence); // No rental contract should return 0 and print message. assertEquals(0, testmethod); rentalcompany.issueCar(drivinglicence, "large"); car1.drive(40); testmethod = rentalcompany.terminateRental(drivinglicence); // Check that message is passed when fuel is liable assertEquals(4, testmethod); rentalcompany.issueCar(drivinglicence, "small"); testmethod = rentalcompany.terminateRental(drivinglicence); // Check that 0 returned and message printed when all conditions met assertEquals(0, testmethod); }