📄 test2_doctors.java
字号:
import junit.framework.TestCase;import hospital.*;public class Test2_Doctors extends TestCase{ public Test2_Doctors(String arg0) { super(arg0); } Hospital h; int docID; String first; String last; protected void setUp() { h = new Hospital(); docID = 5; first = "Mario"; last = "White"; h.addDoctor(first, last, docID); } public void testAdd() throws NoSuchDoctor { Person d = h.getDoctor(docID); assertEquals(first, d.getFirst()); assertEquals(last, d.getLast()); } public void testNotFound() { h.addDoctor(first, last, docID); try { Person d = h.getDoctor(docID+100); assertEquals(d, null); } catch (NoSuchDoctor e) { assertTrue(true); } } public void testInsertTwice() throws NoSuchDoctor { h.addDoctor(first+"X", last+"Y", docID); h.addDoctor(first, last, docID); Person p = h.getDoctor(docID); assertEquals(last, p.getLast()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -