test3_assignpatients.java

来自「A system to manage patients of an hospit」· Java 代码 · 共 60 行

JAVA
60
字号
import junit.framework.TestCase;import hospital.*;public class Test3_AssignPatients extends TestCase {	public Test3_AssignPatients(String name) {		super(name);	}	Hospital h;		protected void setUp() throws Exception {		h = new Hospital();	}		public void testAssignDoctor() throws NoSuchDoctor, NoSuchPatient{		String ssn = "THEPID12I99F181K";		h.addPatient("Giova","Reds", ssn);		int docID = 5;		String dfirst = "Mario";		String dlast = "White";		h.addDoctor(dfirst, dlast, docID);				h.assignPatientToDoctor(ssn, docID);				Patient p = h.getPatient(ssn);				Doctor d = p.getDoctor();		assertEquals(dlast,d.getLast());	}	public void testNoAssignedDoctor() throws NoSuchPatient, NoSuchDoctor{		String ssn = "THEPID12I99F181K";		h.addPatient("Giova","Reds", ssn);		Doctor d = h.getPatient(ssn).getDoctor();		assertSame(null,d);		}  	public void testAssignTwice() throws NoSuchDoctor, NoSuchPatient{		String ssn = "THEPID12I99F181K";		h.addPatient("Giova","Reds", ssn);		int docID = 5;		String dfirst = "Mario";		String dlast = "White";		h.addDoctor(dfirst, dlast, docID);		h.assignPatientToDoctor(ssn, docID);				int docID2 = 6;		String dfirst2 = "John";		String dlast2 = "Peterson";		h.addDoctor(dfirst2, dlast2, docID2);		h.assignPatientToDoctor(ssn, docID2);		Doctor d = h.getPatient(ssn).getDoctor();				assertEquals(dlast2,d.getLast());	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?