lookupmanagerimpltest.java
来自「基于Maven的质量保证自动化环境配置和演示程序」· Java 代码 · 共 43 行
JAVA
43 行
package com.cib.service.impl;import com.cib.dao.LookupDao;import com.cib.model.Role;import com.cib.model.LabelValue;import com.cib.Constants;import org.jmock.Expectations;import org.junit.Before;import org.junit.Test;import static org.junit.Assert.*;import java.util.ArrayList;import java.util.List;public class LookupManagerImplTest extends BaseManagerMockTestCase { private LookupManagerImpl mgr = new LookupManagerImpl(); private LookupDao lookupDao = null; @Before public void setUp() throws Exception { lookupDao = context.mock(LookupDao.class); mgr.setLookupDao(lookupDao); } @Test public void testGetAllRoles() { log.debug("entered 'testGetAllRoles' method"); // set expected behavior on dao Role role = new Role(Constants.ADMIN_ROLE); final List<Role> testData = new ArrayList<Role>(); testData.add(role); context.checking(new Expectations() {{ one(lookupDao).getRoles(); will(returnValue(testData)); }}); List<LabelValue> roles = mgr.getAllRoles(); assertTrue(roles.size() > 0); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?