Question: 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






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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
