Question: How do I write a test case for a class that just calls in objects from another class? The class I am writing the test
How do I write a test case for a class that just calls in objects from another class?
The class I am writing the test case for calls the Patient and PatientHistory classes is:
package medical.com.medicalApplication.model; /** * * * This class represents a medical record model in the system * */ 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; } }
I have attempted to write it but what I had does not work so the method is empty:
public class TestMedicalRecord { private MedicalRecord medicalRecord; private Patient patient; @Before public void setUp() { this.medicalRecord = new MedicalRecord(patient); } @Test public void testGetPatient() { } If you could just make some suggestions or provide an explanation on how to do so I would appreciate it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
