Search in sources :

Example 1 with MethodCounter

use of cn.taketoday.aop.testfixture.advice.MethodCounter in project today-infrastructure by TAKETODAY.

the class Rollback method testRegexpApplied.

@Test
void testRegexpApplied() throws Exception {
    BeanFactory bf = getBeanFactory();
    ITestBean test = (ITestBean) bf.getBean("test");
    MethodCounter counter = (MethodCounter) bf.getBean("countingAdvice");
    assertThat(counter.getCalls()).isEqualTo(0);
    test.getName();
    assertThat(counter.getCalls()).isEqualTo(1);
}
Also used : ITestBean(cn.taketoday.beans.testfixture.beans.ITestBean) BeanFactory(cn.taketoday.beans.factory.BeanFactory) MethodCounter(cn.taketoday.aop.testfixture.advice.MethodCounter) Test(org.junit.jupiter.api.Test)

Example 2 with MethodCounter

use of cn.taketoday.aop.testfixture.advice.MethodCounter in project today-framework by TAKETODAY.

the class Rollback method testRegexpApplied.

@Test
void testRegexpApplied() throws Exception {
    BeanFactory bf = getBeanFactory();
    ITestBean test = (ITestBean) bf.getBean("test");
    MethodCounter counter = (MethodCounter) bf.getBean("countingAdvice");
    assertThat(counter.getCalls()).isEqualTo(0);
    test.getName();
    assertThat(counter.getCalls()).isEqualTo(1);
}
Also used : ITestBean(cn.taketoday.beans.testfixture.beans.ITestBean) BeanFactory(cn.taketoday.beans.factory.BeanFactory) MethodCounter(cn.taketoday.aop.testfixture.advice.MethodCounter) Test(org.junit.jupiter.api.Test)

Aggregations

MethodCounter (cn.taketoday.aop.testfixture.advice.MethodCounter)2 BeanFactory (cn.taketoday.beans.factory.BeanFactory)2 ITestBean (cn.taketoday.beans.testfixture.beans.ITestBean)2 Test (org.junit.jupiter.api.Test)2