Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi i need help implementing the proper code for a JUnit test within my code for

ID: 3905104 • Letter: H

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 org.junit.Test;

public class Doctor {
private String name;
private String id;

public Doctor(String name, String id) {
  super();
  this.name = name;
  this.id = id;
}
public String getName() {
  return name;
}
public void setName(String name) {
  this.name = name;
}
public String getId() {
  return id;
}
public void setId(String id) {
  this.id = id;
}
@Override
public String toString() {
  return "Doctor Name:"+ name + " ID: "+id;
}
}

Explanation / Answer

//Doctor.java public class Doctor { private String name; private String id; public Doctor(String name, String id) { super(); this.name = name; this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } @Override public String toString() { return "Doctor Name:"+ name + " ID: "+id; } } ====================================== //DoctorTest.java import static org.junit.Assert.*; import org.junit.Test; public class DoctorTest { Doctor doctor = new Doctor("Doctor name", "Doctor Id"); @Test public void TestGetName(){ assertEquals(doctor.getName(),"Doctor name"); } @Test public void TestGetID(){ assertEquals(doctor.getId(),"Doctor Id"); } @Test public void TestToString(){ assertEquals(doctor.toString(),"Doctor Name:Doctor name ID: Doctor Id"); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote