Search in sources :

Example 1 with MethodCounter

use of org.springframework.aop.testfixture.advice.MethodCounter in project spring-framework by spring-projects.

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(org.springframework.beans.testfixture.beans.ITestBean) BeanFactory(org.springframework.beans.factory.BeanFactory) MethodCounter(org.springframework.aop.testfixture.advice.MethodCounter) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 MethodCounter (org.springframework.aop.testfixture.advice.MethodCounter)1 BeanFactory (org.springframework.beans.factory.BeanFactory)1 ITestBean (org.springframework.beans.testfixture.beans.ITestBean)1