Question: APPOINTMENT JAVA import java.util.Date; public class Appointment { private String appointmentId; private Date appointmentDate; private String description; public Appointment ( String appointmentId, Date appointmentDate, String
APPOINTMENT JAVA
import java.util.Date;
public class Appointment
private String appointmentId;
private Date appointmentDate;
private String description;
public AppointmentString appointmentId, Date appointmentDate, String description
this.appointmentId appointmentId;
this.appointmentDate appointmentDate;
this.description description;
Getters and setters
public String getAppointmentId
return appointmentId;
public Date getAppointmentDate
return appointmentDate;
public String getDescription
return description;
APPOINTMENT SERVICE JAVA
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class AppointmentService
private Map appointments new HashMap;
public void addAppointmentAppointment appointment
appointments.putappointmentgetAppointmentId appointment;
public void deleteAppointmentString appointmentId
appointments.removeappointmentId;
public void updateAppointmentAppointment updatedAppointment
appointments.putupdatedAppointmentgetAppointmentId updatedAppointment;
public Appointment getAppointmentByIdString appointmentId
return appointments.getappointmentId;
APPOINTMENT SERVICE TEST JAVA
import static org.junit.jupiter.api.Assertions.;
import org.junit.jupiter.api.Test;
import java.util.Date;
public class AppointmentServiceTest
@Test
public void testAddAppointment
AppointmentService appointmentService new AppointmentService;
Date currentDate new Date;
Appointment appointment new AppointmentA currentDate, "Meeting with client";
appointmentService.addAppointmentappointment;
assertNotNullappointmentServicegetAppointmentByIdA;
APPOINTMENT TEST JAVA
import static org.junit.jupiter.api.Assertions.;
import org.junit.jupiter.api.Test;
import java.util.Date;
public class AppointmentTest
@Test
public void testAppointmentCreation
Date currentDate new Date;
Appointment appointment new AppointmentA currentDate, "Meeting with client";
assertEqualsA appointment.getAppointmentId;
assertEqualscurrentDate appointment.getAppointmentDate;
assertEqualsMeeting with client", appointment.getDescription;
I need to redo them with the following corrections.
The appointment object shall have a required unique appointment ID string that cannot be longer than characters. The appointment ID shall not be null and shall not be updatable.
I need to see a null test, test for an id chars and char and char
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 beforenew Date to check if the date is in the past.
I need to see a test for a date in the past
The appointment object shall have a required description String field that cannot be longer than characters. The description field shall not be null.
I need to see a null test, test for description chars, chars, chars
The appointment service shall be able to delete appointments per appointment IDo redo them with the following corrections.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
