📄 testbusinessobjectfactory.java
字号:
package net.sf.irunninglog.businessobject;
import junit.framework.TestCase;
public class TestBusinessObjectFactory extends TestCase {
private String [] validValues;
private String [] invalidValues;
public TestBusinessObjectFactory(String name) {
super(name);
}
public void setUp() {
validValues = new String [] {"Runner", "RunType", "Route", "Shoe"};
invalidValues = new String [] {null, "", "foo"};
}
public void testValidObjectCreation() {
for (int i=0; i< validValues.length; i++) {
try {
assertNotNull(BusinessObjectFactory.newInstance(validValues[i]));
} catch (Throwable ex) {
fail("Should not be here");
}
}
}
public void testInvalidObjectCreation() {
for (int i=0; i< invalidValues.length; i++) {
try {
BusinessObjectFactory.newInstance(invalidValues[i]);
fail("Should not be here");
} catch (Throwable ex) {
assertTrue(true);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -