⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test3_assignpatients.java

📁 A system to manage patients of an hospital (using Inheritance, Exceptions and Collections).
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -