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

📄 testfixedassetservice.java

📁 一个很好的开源项目管理系统源代码
💻 JAVA
字号:
/* */package net.java.workeffort.service;import java.util.ArrayList;import java.util.List;import junit.framework.Test;import junit.framework.TestSuite;import net.java.workeffort.data.DataFileUtil;import net.java.workeffort.params.FixedAssetParams;import net.java.workeffort.service.domain.FixedAsset;import net.java.workeffort.service.domain.FixedAssetQuery;import net.java.workeffort.service.domain.PageResult;import net.java.workeffort.service.support.OptimisticLockingException;/** * Test for fixed asset service. * @author Antony Joseph */public class TestFixedAssetService extends BaseServiceTestCase {    private IFixedAssetService service;    private FixedAssetParams params;    public static Test suite() {        TestSuite suite = new TestSuite();        suite.addTestSuite(TestFixedAssetService.class);        List list = new ArrayList();        list.add(DataFileUtil.FIXED_ASSET);        return new ServiceTestSetup(suite, list);    }    protected void setUp() throws Exception {        super.setUp();        service = (IFixedAssetService) ServiceTestSetup.getApplicationContext()                .getBean("fixedAssetService");        params = new FixedAssetParams();    }    public void testGetFixedAssetPageResult() throws Exception {        FixedAssetQuery query = params.testGetPageResultFixedAsset();        PageResult result = service.getPageResultFixedAsset(query);        assertNotNull("Should not return null object", result.getRows());        assertEquals("Should return 1 row", 1, result.getRows().size());    }    public void testGetFixedAsset() throws Exception {        String pk= params.testGetFixedAsset();        FixedAsset result = service.getFixedAsset(pk);        assertNotNull("Should not return null object", result);    }    public void testInsertFixedAsset() throws Exception {        FixedAsset input = params.testInsertFixedAsset();         service.insertFixedAsset(input);        assertEquals("version should be set to 1.", new Integer(1), input                .getVersion());    }    public void testUpdateFixedAsset() throws Exception {        FixedAsset input = params.testUpdateFixedAsset();        service.updateFixedAsset(input);               assertEquals("version should be incremented to 2.", new Integer(2),                input.getVersion());    }    public void testDeleteFixedAsset() throws Exception {        FixedAsset input = params.testDeleteFixedAsset();        service.deleteFixedAsset(input);        FixedAsset result = service.getFixedAsset(input.getFixedAssetCd());        assertNull("Should return null object", result);    }    public void testUpdateFixedAssetOptLck() throws Exception {        FixedAsset input = params.testUpdateFixedAssetOptLck();        try {           service.updateFixedAsset(input);            fail("An OptimisticLockingException should be raised");        }        catch (OptimisticLockingException expected) {            assertTrue(true);        }    }}

⌨️ 快捷键说明

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