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

📄 testbusinessobjectfactory.java

📁 A Java web application, based on Struts and Hibernate, that serves as an online running log. Users m
💻 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 + -