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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started