Created
February 22, 2020 03:08
-
-
Save automationhacks/597a1adbbad1b83460cd04cda20b1e3f to your computer and use it in GitHub Desktop.
Adding BookingTest with cancellation option as well
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SetupTeardownWithDataProvider { | |
@DataProvider | |
fun getVehicleTypes(): MutableIterator<Array<Any>> { | |
val vehicles = arrayListOf<Array<Any>>() | |
vehicles.add(arrayOf(VehicleType.CAR)) | |
vehicles.add(arrayOf(VehicleType.CAR_XL)) | |
return vehicles.iterator() | |
} | |
@Test(dataProvider = "getVehicleTypes") | |
fun testBookingCreation(vehicleType: VehicleType) { | |
val booking = Booking() | |
val orderId = booking.makeBooking(vehicleType) | |
val isBookingCreated = booking.doesBookingExists(vehicleType, orderId) | |
Assert.assertNotNull(isBookingCreated) | |
} | |
@Test | |
fun testBookingCancellation() { | |
val vehicleType = VehicleType.CAR_XL | |
val booking = Booking() | |
val orderId = booking.makeBooking(vehicleType) | |
val isBookingCreated = booking.doesBookingExists(vehicleType, orderId) | |
Assert.assertNotNull(isBookingCreated) | |
booking.cancelBooking(vehicleType, orderId) | |
val isBookingFound = booking.doesBookingExists(vehicleType, orderId) | |
Assert.assertNotNull(isBookingCreated) | |
Assert.assertFalse(isBookingFound!!) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment