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

📄 hasgeneratedidbotestcase.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 net.sf.irunninglog.canonical.HasGeneratedId;
import net.sf.irunninglog.util.ConstantValues;
import net.sf.irunninglog.util.DTO;


public abstract class HasGeneratedIdBOTestCase extends HasRunnerIdBOTestCase {

    protected static final String V_ID_1 = "abcde";
    protected static final String V_ID_2 = "abcdefghijklmnopqrstuvwxyzabcdef";
    protected static final String I_ID_1 = "abcdefghijklmnopqrstuvwxyzabcdefg";

    public HasGeneratedIdBOTestCase(String name) {
        super(name);
    }

    public void testDefaultValues() {
        super.testDefaultValues();
        executeDefaultValuesTests(HasGeneratedId.FIELD_ID, ConstantValues.STRING_UNSAVED_VALUE);
    }

    public void testFields() {
        super.testFields();

        executeStringFieldTests(HasGeneratedId.FIELD_ID);
    }

    public void testPrimaryKey() {
        super.testPrimaryKey();

        DTO key = null;
        bo.setPrimaryKey(key);
        assertNull(bo.getPrimaryKey());

        key = getNewDTO();
        bo.setPrimaryKey(key);
        assertNull(bo.getPrimaryKey());

        key.setValue(HasGeneratedId.FIELD_ID, V_ID_1);
        bo.setPrimaryKey(key);
        assertEquals(V_ID_1, bo.getPrimaryKey());
    }

    public void testSetValues() {
        super.testSetValues();

        executeSetValuesTests(HasGeneratedId.FIELD_ID,
                              new String [] {null, ConstantValues.STRING_BLANK, V_ID_1, V_ID_2},
                              new String [] {I_ID_1});
    }

    public void testSetValuesInternal() {
        super.testSetValuesInternal();

        executeSetValuesInternalTests(HasGeneratedId.FIELD_ID,
                                      String.class,
                                      new String [] {null, ConstantValues.STRING_BLANK, I_ID_1, V_ID_1, V_ID_2},
                                      new String [] {});
    }

    public void testValidateValues() {
        super.testValidateValues();

        executeValidateValuesTests(HasGeneratedId.FIELD_ID,
                                   new String [] {V_ID_1, V_ID_2},
                                   new String [] {null, ConstantValues.STRING_BLANK, I_ID_1});
    }

}

⌨️ 快捷键说明

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