Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having no luck with this. I have tried for two days to figure it out. Hoping someone can help. __________________________________________________________________________________________ package medical.com.medicalApplication.model; public

I am having no luck with this. I have tried for two days to figure it out. Hoping someone can help.

__________________________________________________________________________________________

package medical.com.medicalApplication.model;

public class MedicalRecord {

private Patient patient; private PatientHistory history; public MedicalRecord(Patient patient) { super(); this.patient = patient; this.history = new PatientHistory(); }

public Patient getPatient() { return patient; }

public PatientHistory getHistory() { return history; } }

__________________________________________________________________________________________

package medical.com.medicalApplication.model;

import java.util.ArrayList; import java.util.List; public class PatientHistory {

private List treatments; private List medications; private List allergy;

public PatientHistory() { this.treatments = new ArrayList(); this.medications = new ArrayList(); this.allergy = new ArrayList(); }

public void addTreatment(Treatment treatment) { treatments.add(treatment); }

public void addAllergy(Allergey allegry) { allergy.add(allegry); }

public void addMedication(Medication medication) { if(treatments != null){ medications.add(medication); } }

public List getAlergies() { return allergy; }

public List getAllTreatments() { return treatments; }

public List getAllMedications() { return medications; }

} __________________________________________________________________________________________

This is what I have for the JUnit Test. My test case for patient history works fine. I guess I am not clear how I can pass data into the patient history class from the medical records class?

package medical.com.medicalApplication.model;

import static org.junit.Assert.*;

import org.junit.Before; import org.junit.Test; import medical.com.medicalApplication.model.MedicalRecord; import medical.com.medicalApplication.model.Patient;

public class MedicalRecordTest2 {

MedicalRecord medicalRecord = new MedicalRecord(new Patient("John Jacob", "5544"));

@Test public void testMedicalRecordGetPatient(){ assertEquals(medicalRecord.getPatient().toString(), "Patient Name: John Jacob ID: 5544"); }

}

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago