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

📄 test1_patients.java

📁 A system to manage patients of an hospital (using Inheritance, Exceptions and Collections).
💻 JAVA
字号:
import junit.framework.TestCase;import hospital.*;public class Test1_Patients extends TestCase {	public Test1_Patients(String arg0) {		super(arg0);	}		public void testAdd() throws NoSuchPatient {		Hospital h = new Hospital();		String ssn = "THEPID12I99F181K";		String first = "Giova";		String last = "Reds";		h.addPatient(first, last, ssn);		Patient p = h.getPatient(ssn);		assertEquals(first, p.getFirst());		assertEquals(last, p.getLast());	}		public void testNotFoundEmpty() {		Hospital h = new Hospital();		String ssn = "THEPID12I99F181K";		try {			Patient p = h.getPatient(ssn);			assertEquals(p, null);		} catch (NoSuchPatient e) {			assertTrue(true);			}	}//? this test is passing	public void testAddNull() {		Hospital h = new Hospital();		h.addPatient(null, null, null);	}		public void testNotFound() {		Hospital h = new Hospital();				String ssn = "THEPID12I99F181K";		String first = "Giova";		String last = "Reds";				h.addPatient(first, last, ssn);				try {			Person p = h.getPatient(ssn + "_");			assertEquals(p, null);		} catch (NoSuchPatient e) {			assertTrue(true); //?			}	}		public void testInsertTwice() throws NoSuchPatient {				Hospital h = new Hospital();				String ssn = "THEPID12I99F181K";		String first = "Giova";		String last = "Reds";				h.addPatient(first+"X", last+"Y", ssn);		h.addPatient(first, last, ssn);				Person p = h.getPatient(ssn);		assertEquals(first, p.getFirst());	}}

⌨️ 快捷键说明

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