test2_doctors.java
来自「A system to manage patients of an hospit」· Java 代码 · 共 45 行
JAVA
45 行
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 + =
减小字号Ctrl + -
显示快捷键?