Question: Hi i need help implementing the proper code for a JUnit test within my code for eclipse oxygen: package medical.com.medicalApplication.model; import static org.junit.Assert.*; import java.util.ArrayList;
Hi i need help implementing the proper code for a JUnit test within my code for eclipse oxygen:
package medical.com.medicalApplication.model;
import static org.junit.Assert.*;
import java.util.ArrayList; import java.util.Collections; import java.util.List;
import org.junit.Test;
import medical.com.medicalApplication.services.MedicalRescordService;
public class TestMedicalRescordService {
public class MedicalRescordService { private static MedicalRescordService reference = new MedicalRescordService(); private List
public static MedicalRescordService getReference() { return reference; }
MedicalRescordService() { this.patients = new ArrayList
public boolean addPatient(String name, String id) { boolean patientAdded = !patients.stream() .anyMatch(patient -> patient.getId().equals(id)); if (patientAdded) { Patient newPatient = new Patient(name, id); patients.add(newPatient); medicalRecords.add(new MedicalRecord(newPatient)); } return patientAdded; } public MedicalRecord getMedicalRecord(String patientId) { return medicalRecords.stream() .filter(medicalRecord -> medicalRecord.getPatient().getId().equals(patientId)).findFirst().get(); }
public Patient getPatient(String patientId) { return patients.stream().filter(person -> person.getId().equals(patientId)) .findFirst().get(); }
public List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
