Answered step by step
Verified Expert Solution
Question
1 Approved Answer
having issues with importing from jar file In this assignment, you will black - box unit test the Reservation class of a small bed &
having issues with importing from jar file
In this assignment, you will blackbox unit test the Reservation class of a small bed & breakfast reservation system. You will be given a Java jar file that includes:
a Java class file of the Reservation class and
a Java class file of the Assert library class that is used for testing.
Additionally, you will be given the specifications of both of these two given class files.
You will create four sets of blackbox functional unit test cases composed of Selected Inputs, Expected Result, Actual Result, PassFail to test the constructor and the public methods of the Reservation class. Then, using the provided jar files, you will code Java unit tests to execute your test cases and record their PassFail verdicts. You will also explain your approach to create these blackbox functional unit test cases and tests, the steps you followed, and the rationale behind your tests. You will reflect on the assignment and lessons learned.
To prepare for this assignment:
Review the assigned reading for the week.
Prepare a Java development environment. You can use the Java command line interface environment or any Java IDE eg Eclipse or NetBeans Java instructions eg how to compile, integrate the provided Java jar file into your development environment, etc. will be given using the command line interface. Adjust these instructions to your selected Java IDE if you choose to use one.
Read the software development requirements for a small bed & breakfast reservation system SWDevReqSmallBBReservationSysdocxin the attached AssignmentResourcesWzip file. These are the same requirements as those for week and week assignments but repeated here for completeness.
Read the analysis model for a small bed & breakfast reservation system AnalysisModelSmallBBReservationSysdocxin the attached AssignmentResourcesWzip file. This analysis model was developed based on the software development requirements for a small bed & breakfast reservation system. This is the same analysis model as the analysis model for week assignment but repeated here for completeness.
Read the specifications of the Reservation class of the small bed & breakfast reservati
TestReservation.java
import java.util.;
import wAssert;
@Test
The TestReservation class in Java contains methods to test constructors, getters, setters, and
calculation functions for a Reservation object.
public class TestReservation
The main function calls other functions related to constructors, getters, setters, calculating
reservation number of days, and calculating reservation bill amount.
public static void mainString args throws Exception
ConstructorAndGetters;
SettersAndGetters;
CalculateReservationNumberOfDays;
CalculateReservationBillAmount;
Constructor & getters
The function creates a Reservation object with specific details and asserts the values
returned by its getters.
public static void ConstructorAndGetters
Reservation r new Reservation "Ronald Parra", ;
Assert.assertEquals rgetId;
Assert.assertEqualsRonald rgetName;
Assert.assertEquals rgetStartDate;
Assert.assertEquals rgetEndDate;
Setters & getters
The function SettersAndGetters sets and gets values for an object's id name, start date,
and end date properties, and asserts the expected values.
public static void SettersAndGetters
rsetId;
Assert.assertEquals rgetId;
rsetNameRonald ;
Assert.assertEqualsRonald rgetName;
rsetStartDate;
Assert.assertEquals rgetStartDate;
rsetEndDate;
Assert.assertEquals rgetEndDate;
calculateReservationNumberOfDays
The function CalculateReservationNumberOfDays in Java asserts that the number of days
calculated by r is equal to
public static void CalculateReservationNumberOfDays throws Exception
Assert.assertEquals rcalculateReservationNumberOfDays;
calculateReservationBillAmount
The function CalculateReservationBillAmount in Java asserts that the calculated
reservation bill amount is equal to
public static void CalculateReservationBillAmount throws Exception
Assert.assertEquals rcalculateReservationBillAmount;
issues trying to run this code fora black box testing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started