Answered step by step
Verified Expert Solution
Link Copied!

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 black-box unit test the Reservation class of a small bed & breakfast reservation system. You will be given a Java jar file that includes:
1) a Java class file of the Reservation class and
2) 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 (4) sets of black-box functional unit test cases (composed of Selected Inputs, Expected Result, Actual Result, Pass|Fail) 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 Pass|Fail verdicts. You will also explain your approach to create these black-box 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:
1) Review the assigned reading for the week.
2) Prepare a Java development environment. You can use the Java command line interface environment or any Java IDE (e.g., Eclipse or NetBeans). Java instructions (e.g., 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.
3) Read the software development requirements for a small bed & breakfast reservation system (SW-Dev-Req-Small-BB-Reservation-Sys.docx)in the attached Assignment-Resources-W6.zip file. These are the same requirements as those for week 2 and week 4 assignments but repeated here for completeness.
4) Read the analysis model for a small bed & breakfast reservation system (Analysis-Model-Small-BB-Reservation-Sys.docx)in the attached Assignment-Resources-W6.zip 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 4 assignment but repeated here for completeness.
5) Read the specifications of the Reservation class of the small bed & breakfast reservati
// TestReservation.java
import java.util.*;
import w6.Assert;
@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 main(String[] 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 r1= new Reservation(1, "Ronald Parra", "2024-02-14","2022-02-21");
Assert.assertEquals(1, r1.getId());
Assert.assertEquals("Ronald ", r1.getName());
Assert.assertEquals("2024-02-14", r1.getStartDate());
Assert.assertEquals("2022-02-21", r1.getEndDate());
}
// 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(){
r1.setId(2);
Assert.assertEquals(2, r1.getId());
r1.setName("Ronald ");
Assert.assertEquals("Ronald ", r1.getName());
r1.setStartDate("2024-02-14");
Assert.assertEquals("2024-02-14", r1.getStartDate());
r1.setEndDate("2024-02-21");
Assert.assertEquals("2024-02-21", r1.getEndDate());
}
// calculateReservationNumberOfDays()
/**
* The function CalculateReservationNumberOfDays() in Java asserts that the number of days
* calculated by r1 is equal to 8.
*/
public static void CalculateReservationNumberOfDays() throws Exception{
Assert.assertEquals(8, r1.calculateReservationNumberOfDays());
}
// calculateReservationBillAmount()
/**
* The function CalculateReservationBillAmount() in Java asserts that the calculated
* reservation bill amount is equal to 200.0.
*/
public static void CalculateReservationBillAmount() throws Exception{
Assert.assertEquals(200.0, r1.calculateReservationBillAmount());
}
} issues trying to run this code fora black box testing
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

New Trends In Databases And Information Systems Adbis 2019 Short Papers Workshops Bbigap Qauca Sembdm Simpda M2p Madeisd And Doctoral Consortium Bled Slovenia September 8 11 2019 Proceedings

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Robert Wrembel ,Mirjana Ivanovic ,Johann Gamper ,Mikolaj Morzy ,Theodoros Tzouramanis ,Jerome Darmont

1st Edition

ISBN: 3030302776, 978-3030302771

Students also viewed these Databases questions