今天在跟B站学习aop的过程中,想要编写测试类来测试自己的aop到底成不成功,于是编写测试类如下:
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.itheima.service.IAccountService;
import junit.framework.TestCase;
public class testAccountService extends TestCase {
ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
IAccountService as = (IAccountService)ac.getBean("accountService");
public void transferTest(){
as.transfer("bbb", "aaa", 100);
}
}
得到的报错结果如下:
junit.framework.AssertionFailedError: No tests found in com.itheima.test.testAccountService
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java:263)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.fra