with the requirements. Your job is to code the application and provide unit tests to verify...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
with the requirements. Your job is to code the application and provide unit tests to verify that the application meets the customer's requirements. For this milestone, you will focus on delivering the appointment services. The purpose of these services is to add, update, and delete appointment objects within the application. The appointment service uses in-memory data structures to support storing appointments (no database required). In addition, there is no user interface for this milestone. You will verify the appointment service through JUnit tests. The appointment service contains an appointment object along with the appointment service. The requirements are outlined below. Appointment Class Requirements The appointment object shall have a required unique appointment ID string that cannot be longer than 10 characters. The appointment ID shall not be null and shall not be updatable. The appointment object shall have a required appointment Date field. The appointment Date field cannot be in the past. The appointment Date field shall not be null. Note: Use java.util.Date for the appointmentDate field and use before(new Date()) to check if the date is in the past. The appointment object shall have a required description String field that cannot be longer than 50 characters. The description field shall not be null. Appointment Service Requirements The appointment service shall be able to add appointments with a unique appointment ID. The appointment service shall be able to delete appointments per appointment ID. What to Submit To complete this project, you must submit an Appointment Service zipped folder containing the following deliverables: Appointment.java AppointmentService.java AppointmentTest.java AppointmentServiceTest.java Package Explorer X 5: *Appointment.java X 1 import java.util.Date; AppointmentService.java *AppointmentTest.java *AppointmentServiceTest.java AppointmentService JRE System Library [JavaSE-17] *#src (default package) Appointment.java > AppointmentService.java AppointmentServiceTest.ja > AppointmentTest.java > JUnit 5 3 public class Appointment { 7 private String appointmentID; private Date appointmentDate; private String description; public Appointment (String appointmentID, Date appointmentDate, String description) { this.appointmentID = appointmentID; 12 13 } this.appointmentDate = appointmentDate; this.description = description; public String getAppointmentID() { 16 } 20 21 return appointmentID; public Date getAppointmentDate() { return appointmentDate; } public String getDescription() { } return description; } Package Explorer X 5: *Appointment.java X 1 import java.util.Date; AppointmentService.java *AppointmentTest.java *AppointmentServiceTest.java AppointmentService JRE System Library [JavaSE-17] *#src (default package) Appointment.java > AppointmentService.java AppointmentServiceTest.ja > AppointmentTest.java > JUnit 5 3 public class Appointment { 7 private String appointmentID; private Date appointmentDate; private String description; public Appointment (String appointmentID, Date appointmentDate, String description) { this.appointmentID = appointmentID; 12 13 } this.appointmentDate = appointmentDate; this.description = description; public String getAppointmentID() { 16 } 20 21 return appointmentID; public Date getAppointmentDate() { return appointmentDate; } public String getDescription() { } return description; } Package Explorer X AppointmentService JRE System Library [JavaSE-17] *src AppointmentService.java (default package) > Appointment.java > > Appointment ServiceTest.j > AppointmentTest.java > JUnit 5 Appointment.java AppointmentService.java **AppointmentTest.java *AppointmentServiceTest.java X 10 import static org.junit.jupiter.api.Assertions.*; b import java.util.Calendar; import java.util.Date; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class Appointment Test { private String description; private String tooLong ID; private String tooLongDescription; private Date date; private Date pastDate; @BeforeEach void setUp() { description = "The appt object shall have a required description."; tooLong ID = "111222333444555666777888999"; tooLongDescription = "This description is too long for the appointment requirements but good for testing."; date = new Date(2021 1900...Calendar.JANUARY.....1).; pastDate = new Date(0); Ex Ex Ex Sx Ex } @Test void testUpdateAppointmentID() { } Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, ()-> appointment.updateAppointmentID (null)); assertThrows (IllegalArgumentException.class, () -> appointment.updateAppointmentID (too Long ID)); appointment.updateAppointmentID("1234567890"); assertEquals("1234567890", appointment.getAppointmentID()); @Test void testGetAppointmentID() { } Appointment appointment = new Appointment ("1234567890", date, description); assertNotNull(appointment.getAppointmentID()); assertEquals(10, appointment.getAppointmentID().length()); assertEquals("1234567890", appointment.getAppointmentID()); @Test void testUpdateDate() { Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, () -> appointment.updateDate (pastDate)); appointment.updateDate (null); appointment.updateDate(date); assertEquals(date, appointment.getAppointmentDate()); @Test void testGetAppointmentDate() { Appointment appointment = new Appointment ("1234567890", date, description); assertNotNull(appointment.getAppointmentDate()); assertEquals(date, appointment.getAppointmentDate()); @Test void testUpdateDescription() { Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (null)); assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (too LongDescription)); appointment.updateDescription (description); assertEquals(description, appointment.getDescription()); } 48 } 55 560 x58 Sx Ex fx Problems X @Javadoc . Declaration. 4 errors, 0 warnings, 0 others Description A Resource Path Location Type Errors (4 items) ** The method getAppointmentID() is undefined f Appointment Tes /AppointmentService/s line 32 Java Problem Package Explorer X AppointmentService JRE System Library [JavaSE-17] src (default package) Appointment.java > AppointmentService.java AppointmentServiceTest.ja > AppointmentTest.java > JUnit 5 Appointment.java *AppointmentService.java *AppointmentTest.java X *AppointmentServiceTest.java 10 import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api. BeforeEach; 4 import org.junit.jupiter.api.Test; 5 6 import java.util.Date; 8 class Appointment ServiceTest { 130 14 private Appointment Service appointment Service; private Date validDate; private Appointment validAppointment; @BeforeEach void setUp() { appointmentService = new AppointmentService(); validDate = new Date(System.currentTimeMillis() + 3600000); // Set to valid date (1 hour from now) validAppointment = new Appointment ("1234567890", validDate, "Valid description"); 18 19 200 @Test void testAddAppointment () { appointmentService.addAppointment (validAppointment); assertEquals (validAppointment, appointmentService.getAppointments().get("1234567890")); 24 25 260 } @Test void testAddAppointment DuplicateID() { appointmentService.addAppointment (validAppointment); // Adding an appointment with the same ID should throw an exception assertThrows (IllegalArgumentException.class, () -> appointmentService.addAppointment (new Appointment("1234567890", validDate, "Duplicate ID"))); @Test void testAddAppointmentNullAppointment() { assertThrows (IllegalArgumentException.class, () -> appointment Service.addAppointment (null)); @Test void testAddAppointmentNullID() { assertThrows (IllegalArgumentException.class, () -> appointmentService.addAppointment (new Appointment (null, validDate, "Null ID"))); 33 34 } 350 36 38 } 39 400 41 42 44 } 45 460 @Test 47 48 49 51 } 52 530 void testDeleteAppointment () { appointmentService.addAppointment (validAppointment); appointmentService.deleteAppointment ("1234567890"); assertNull(appointment Service.getAppointment().get("1234567890")); @Test void testDeleteNonexistentAppointment () { assertThrows (IllegalArgumentException.class, () -> appointmentService.deleteAppointment ("NonexistentID")); 56 57} } Problems X @Javadoc Declaration 4 errors, 0 warnings, 0 others Description Errors (4 items) A Resource Path Location | xThe method getAppointmentID() is undefined f Appointment Tes /AppointmentService/s line 32 fx The method getAppointmentID() is undefined f AppointmentTes /Appointment Service/s line 38 The method getAppointmentID() is undefined f Appointment Tes /Appointment Service/s line 39 The method getAppointmentID() is undefined f Appointment Tes /AppointmentService/s line 40 Java Problem Java Problem Java Problem Java Problem A void testUpdateDescription () { } Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (null)) assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (tooLon appointment.updateDescription (description); assertEquals(description, appointment.getDescription()); 56 @Test 57 x58 x59 x60 x61 62 64 66 67 68 59 70 } 72 @Test void testGetDescription() { Appointment appointment = new Appointment ("1234567890", date, description); assertNotNull(appointment.getDescription()); assertTrue(appointment.getDescription().length() < 59); assertEquals(description, appointment.getDescription()); Droblemo Declaration with the requirements. Your job is to code the application and provide unit tests to verify that the application meets the customer's requirements. For this milestone, you will focus on delivering the appointment services. The purpose of these services is to add, update, and delete appointment objects within the application. The appointment service uses in-memory data structures to support storing appointments (no database required). In addition, there is no user interface for this milestone. You will verify the appointment service through JUnit tests. The appointment service contains an appointment object along with the appointment service. The requirements are outlined below. Appointment Class Requirements The appointment object shall have a required unique appointment ID string that cannot be longer than 10 characters. The appointment ID shall not be null and shall not be updatable. The appointment object shall have a required appointment Date field. The appointment Date field cannot be in the past. The appointment Date field shall not be null. Note: Use java.util.Date for the appointmentDate field and use before(new Date()) to check if the date is in the past. The appointment object shall have a required description String field that cannot be longer than 50 characters. The description field shall not be null. Appointment Service Requirements The appointment service shall be able to add appointments with a unique appointment ID. The appointment service shall be able to delete appointments per appointment ID. What to Submit To complete this project, you must submit an Appointment Service zipped folder containing the following deliverables: Appointment.java AppointmentService.java AppointmentTest.java AppointmentServiceTest.java Package Explorer X 5: *Appointment.java X 1 import java.util.Date; AppointmentService.java *AppointmentTest.java *AppointmentServiceTest.java AppointmentService JRE System Library [JavaSE-17] *#src (default package) Appointment.java > AppointmentService.java AppointmentServiceTest.ja > AppointmentTest.java > JUnit 5 3 public class Appointment { 7 private String appointmentID; private Date appointmentDate; private String description; public Appointment (String appointmentID, Date appointmentDate, String description) { this.appointmentID = appointmentID; 12 13 } this.appointmentDate = appointmentDate; this.description = description; public String getAppointmentID() { 16 } 20 21 return appointmentID; public Date getAppointmentDate() { return appointmentDate; } public String getDescription() { } return description; } Package Explorer X 5: *Appointment.java X 1 import java.util.Date; AppointmentService.java *AppointmentTest.java *AppointmentServiceTest.java AppointmentService JRE System Library [JavaSE-17] *#src (default package) Appointment.java > AppointmentService.java AppointmentServiceTest.ja > AppointmentTest.java > JUnit 5 3 public class Appointment { 7 private String appointmentID; private Date appointmentDate; private String description; public Appointment (String appointmentID, Date appointmentDate, String description) { this.appointmentID = appointmentID; 12 13 } this.appointmentDate = appointmentDate; this.description = description; public String getAppointmentID() { 16 } 20 21 return appointmentID; public Date getAppointmentDate() { return appointmentDate; } public String getDescription() { } return description; } Package Explorer X AppointmentService JRE System Library [JavaSE-17] *src AppointmentService.java (default package) > Appointment.java > > Appointment ServiceTest.j > AppointmentTest.java > JUnit 5 Appointment.java AppointmentService.java **AppointmentTest.java *AppointmentServiceTest.java X 10 import static org.junit.jupiter.api.Assertions.*; b import java.util.Calendar; import java.util.Date; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class Appointment Test { private String description; private String tooLong ID; private String tooLongDescription; private Date date; private Date pastDate; @BeforeEach void setUp() { description = "The appt object shall have a required description."; tooLong ID = "111222333444555666777888999"; tooLongDescription = "This description is too long for the appointment requirements but good for testing."; date = new Date(2021 1900...Calendar.JANUARY.....1).; pastDate = new Date(0); Ex Ex Ex Sx Ex } @Test void testUpdateAppointmentID() { } Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, ()-> appointment.updateAppointmentID (null)); assertThrows (IllegalArgumentException.class, () -> appointment.updateAppointmentID (too Long ID)); appointment.updateAppointmentID("1234567890"); assertEquals("1234567890", appointment.getAppointmentID()); @Test void testGetAppointmentID() { } Appointment appointment = new Appointment ("1234567890", date, description); assertNotNull(appointment.getAppointmentID()); assertEquals(10, appointment.getAppointmentID().length()); assertEquals("1234567890", appointment.getAppointmentID()); @Test void testUpdateDate() { Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, () -> appointment.updateDate (pastDate)); appointment.updateDate (null); appointment.updateDate(date); assertEquals(date, appointment.getAppointmentDate()); @Test void testGetAppointmentDate() { Appointment appointment = new Appointment ("1234567890", date, description); assertNotNull(appointment.getAppointmentDate()); assertEquals(date, appointment.getAppointmentDate()); @Test void testUpdateDescription() { Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (null)); assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (too LongDescription)); appointment.updateDescription (description); assertEquals(description, appointment.getDescription()); } 48 } 55 560 x58 Sx Ex fx Problems X @Javadoc . Declaration. 4 errors, 0 warnings, 0 others Description A Resource Path Location Type Errors (4 items) ** The method getAppointmentID() is undefined f Appointment Tes /AppointmentService/s line 32 Java Problem Package Explorer X AppointmentService JRE System Library [JavaSE-17] src (default package) Appointment.java > AppointmentService.java AppointmentServiceTest.ja > AppointmentTest.java > JUnit 5 Appointment.java *AppointmentService.java *AppointmentTest.java X *AppointmentServiceTest.java 10 import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api. BeforeEach; 4 import org.junit.jupiter.api.Test; 5 6 import java.util.Date; 8 class Appointment ServiceTest { 130 14 private Appointment Service appointment Service; private Date validDate; private Appointment validAppointment; @BeforeEach void setUp() { appointmentService = new AppointmentService(); validDate = new Date(System.currentTimeMillis() + 3600000); // Set to valid date (1 hour from now) validAppointment = new Appointment ("1234567890", validDate, "Valid description"); 18 19 200 @Test void testAddAppointment () { appointmentService.addAppointment (validAppointment); assertEquals (validAppointment, appointmentService.getAppointments().get("1234567890")); 24 25 260 } @Test void testAddAppointment DuplicateID() { appointmentService.addAppointment (validAppointment); // Adding an appointment with the same ID should throw an exception assertThrows (IllegalArgumentException.class, () -> appointmentService.addAppointment (new Appointment("1234567890", validDate, "Duplicate ID"))); @Test void testAddAppointmentNullAppointment() { assertThrows (IllegalArgumentException.class, () -> appointment Service.addAppointment (null)); @Test void testAddAppointmentNullID() { assertThrows (IllegalArgumentException.class, () -> appointmentService.addAppointment (new Appointment (null, validDate, "Null ID"))); 33 34 } 350 36 38 } 39 400 41 42 44 } 45 460 @Test 47 48 49 51 } 52 530 void testDeleteAppointment () { appointmentService.addAppointment (validAppointment); appointmentService.deleteAppointment ("1234567890"); assertNull(appointment Service.getAppointment().get("1234567890")); @Test void testDeleteNonexistentAppointment () { assertThrows (IllegalArgumentException.class, () -> appointmentService.deleteAppointment ("NonexistentID")); 56 57} } Problems X @Javadoc Declaration 4 errors, 0 warnings, 0 others Description Errors (4 items) A Resource Path Location | xThe method getAppointmentID() is undefined f Appointment Tes /AppointmentService/s line 32 fx The method getAppointmentID() is undefined f AppointmentTes /Appointment Service/s line 38 The method getAppointmentID() is undefined f Appointment Tes /Appointment Service/s line 39 The method getAppointmentID() is undefined f Appointment Tes /AppointmentService/s line 40 Java Problem Java Problem Java Problem Java Problem A void testUpdateDescription () { } Appointment appointment = new Appointment(); assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (null)) assertThrows (IllegalArgumentException.class, () -> appointment.updateDescription (tooLon appointment.updateDescription (description); assertEquals(description, appointment.getDescription()); 56 @Test 57 x58 x59 x60 x61 62 64 66 67 68 59 70 } 72 @Test void testGetDescription() { Appointment appointment = new Appointment ("1234567890", date, description); assertNotNull(appointment.getDescription()); assertTrue(appointment.getDescription().length() < 59); assertEquals(description, appointment.getDescription()); Droblemo Declaration
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
As you have learned in Modules One and Two, various types of software testing can be employed for a given situation. For this assignment, you will be creating unit tests using code to uncover errors...
-
The appointment service uses in-memory data structures to support storing appointments (no database required). In addition, there is no user interface for this milestone. You will verify the...
-
Can hydrogen or deuterium emit an particle? Explain.
-
Apply a VRIO analysis. What are InterfaceRAISE's resources, competencies, and capabilities? Can they be a source of competitive advantage? Why or why not?
-
Caitlin spends her money on tuition and books. One credit hour of tuition costs her $320; each book costs her $200. Currently, the marginal utility of a credit hour to Caitlin is 80; the marginal...
-
This case stems from a rocky relationship between two Texans. Lawrence Shipley was the president of Shipley Do-Nut Flour & Supply Co., and Andrea Vasquez was a substitute school teacher in the...
-
Given the following project to landscape a new building site, (a) Draw a Gantt chart using MSP. (b) Find the critical path and project duration in days. (c) Given that each resource is assigned 100%...
-
For October, the coat department did $26,800 in sales and took 30% markdowns. What are the markdown dollars for the coat department in October?
-
What are the responsibilities of data link layer?
-
Wilson Thomas is in the 40% federal and state income tax bracket. At a recent United Way charity auction, Wilson paid $2,000 for season tickets to a local theatre company's productions. The tickets...
-
Husker's Tuxedo's, needs to raise $259 million to finance its plan for expansion. Huskers learns that the bankers recommend an offer price (or gross price) of $40 per share and they will charge an...
-
ABC Trucking's balance sheet shows a total of noncallable $38 million long-term debt with a coupon rate of 5.60% and a yield to maturity of 8.80%. This debt currently has a market value of $55...
-
July 15 Declared a cash dividend payable to common stockholders of $176,000. Aug. 15 Date of record is August 15 for the cash dividend declared on July 15. Aug. 31 Paid the dividend declared on July...
-
On December 31, 2019, when the market rate was 12%, Drum Corp issued $2,000,000, 14%, 5-year bonds. Interest is payable semi-annually on June 30 and December 31. The bonds were issued for $2,147,214,...
-
Enter the volume of the cylinder to the nearest hundredth. diameter: 8 ft. height: 6 ft. The volume is: _____ ft 3 .
-
A copper sphere of 10-mm diameter, initially at a prescribed elevated temperature T;, is quenched in a saturated (1 atm) water bath. Using the lumped capacitance method, estimate the time for the...
-
To what extent did the title of the video cause difficulties?
-
The questionnaire below describes aspects of leadership behaviour. Respond to each item according to the way you would most likely act if you were leader of a work group. Circle whether you would...
-
Discuss the main sources of power and leadership influence. give a practical example of each of these main sources of power and influence within your own university or organisation.
-
The perfectly competitive model assumes that firms know when marginal revenue equals marginal costs. a. If a firm doesnt have this information, can it produce at the profit-maximizing level of...
-
Hundreds of music stores have been closing in the face of stagnant demand for CDs because of new competition by online music vendors. a. How would price competition from these new sources cause a...
-
A California biotechnology firm submitted a tomato that will not rot for weeks to the U.S. Food and Drug Administration. It designed such a fruit by changing the genetic structure of the tomato. What...
Study smarter with the SolutionInn App