📄 cacheinterceptortest.java
字号:
package com.ejsun.entapps.test.core;
import junit.framework.TestCase;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
/**
* @author Quake Wang
* @since 2004-5-18
* @version $Revision: 1.1 $
*
**/
public class CacheInterceptorTest extends TestCase {
private static BeanFactory beanFactory;
protected void setUp() throws Exception {
if(beanFactory == null)
beanFactory = new XmlBeanFactory(new ClassPathResource("test_cache_interceptor.xml", getClass()));
}
public void testCacheInterceptor() {
CacheInterceptorTestBean testBean = (CacheInterceptorTestBean) beanFactory.getBean("testBean");
String foo = testBean.loadFooById(1);
assertEquals(1, testBean.getInvokeTimes());
String aFoo = testBean.loadFooById(1);
assertEquals(foo, aFoo);
assertEquals(1, testBean.getInvokeTimes());
testBean.updateFoo(1, "abc");
String bFoo = testBean.loadFooById(1);
assertEquals(2, testBean.getInvokeTimes());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -