Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sample Solution - Week 6 Assignment Test Cases for the Reservation class Assumptions: All input data are assumed valid, and thus we are not testing

Sample Solution - Week 6 Assignment Test Cases for the Reservation class Assumptions: All input data are assumed valid, and thus we are not testing for invalid input data. This means that all the parameters of the test methods should contain valid parameter values Room types are: 1) RoomWBath, 2) RoomWView, 3) NormalRoom and they are all of type String Room daily rates are: 1) RoomWBath -> [$200], 2) RoomWView -> [$175], 3) NormalRoom -> [$125] The pattern for a Date variable as a string has this format: MMM dd, yyyy All inputted reservation dates are valid. That is reservation end date > reservation start date The Reservation class codes compiles without any syntax errors We are not testing the methods of 1) updateReservaton() and 2) dropReservation() as their code is not ready yet for testing. They are not tested These four sets of black-box functional tests were conducted: 1. Testing constructor & getters (test cases and screenshots of unit tests Java code and its results) 2. Testing setters & getters (test cases and unit tests Java code) 3. Testing calculateReservationNumberOfDays() (test cases and screenshots of unit tests Java code and its results) 4. Testing calculateReservationBillAmount() (test cases and screenshots of unit tests Java code and its results) 1. Testing constructor & getters (test cases and screenshots of unit tests Java code and its results) Test case # Selected Inputs guestID, roomType, startDate, endDate Expected Result Actual Result Pass | Fail 1 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" & 7, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" unique UUID reservationIDs two unique UUID NOT equal to each other Pass 2 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" reservation date is todays date as a Java Date type with milliseconds todays date as a Java Date type with milliseconds Fail because of differences in millisecond when getting todays date 3 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" reservation date is todays date using the MMM dd, yyyy pattern todays date using the MMM dd, yyyy pattern Pass 4 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" guestID == 1 1 Pass 5 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" roomType == RoomWBath RoomWBath Pass 6 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" startDate == Jun 16, 2022 Jun 16, 2022 Pass 7 1, "RoomWBath", "Jun 16, 2022", "Jun 19, 2022" endDate == "Jun 19, 2022" "Jun 19, 2022" Pass 2. Testing setters & getters (test cases and screenshots of unit tests Java code and its results) Test case # Selected Inputs guestID, roomType, startDate, endDate Expected Result Actual Result Pass | Fail 1 7, "NormalRoom", "Jan 07, 2023", "Jan 17, 2023" & set guestID = 77 guestID == 77 77 Pass 2 7, "NormalRoom", "Jan 07, 2023", "Jan 17, 2023" & set roomType = RoomWView roomType == RoomWView RoomWView Pass 3 7, "NormalRoom", "Jan 07, 2023", "Jan 17, 2023" & set startDate = Jan 10, 2023 startDate = Jan 10, 2023 Jan 07, 2023 Fail fail because the setReservationStartDate() sets the endDate and not the startDate. Should look like this: this.reservationStartDate = newValue; 4 7, "NormalRoom", "Jan 07, 2023", "Jan 17, 2023" & set endDate = Jan 15, 2023 endDate = Jan 15, 2023 Jan 15, 2023 Pass 3. Testing calculateReservationNumberOfDays() (test cases and screenshots of unit tests Java code and its results) Test case # Selected Inputs guestID, roomType, startDate, endDate Expected Result Actual Result Pass | Fail 1 1, "RoomWBath", "Jun 12, 2022", "Jun 14, 2022" 2L 2L Pass 2 11, "NormalRoom", "Dec 27, 2020", "Jan 04, 2021" 8L 8L Pass 3 34, "NormalRoom", "Feb 27, 2022", "Mar 02, 2022" 3L 3L Pass 4 99, "RoomWBath", "Jul 27, 2024", "Jul 28, 2024" 1L 1L Pass 4. Testing calculateReservationBillAmount() (test cases and screenshots of unit tests Java code and its results) Test case # Selected Inputs custID, roomType, startDate, endDate Expected Result Actual Result Pass | Fail 1 1, "RoomWBath", "Jun 12, 2022", "Jun 14, 2022" 400 0 Fail fail because we are using the var private long reservationNumberOfDays which is not initialized should be calling this method instead: calculateReversationNumberOfDays() 2 5, "RoomWView", "Mar 21, 2024", "Mar 26, 2024" 875 875 Pass 3 67, "NormalRoom", "Sep 01, 2023", "Sep 05, 2023" 500 480 Fail fail because we are using the wrong rate for a normal room should be 125 instead of 120: instead: return (125 * calculateReversationNumberOfDays());

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions