java - Spring Aspect Advice @Test methods -
i have test class :
@runwith(springjunit4classrunner.class) @contextconfiguration(classes = integrationtestconfig.class) @transactional @component public class apptest { @autowired private simpleservice simpleservice; @test public void test() { simpleservice.test(); } }
i want make aspect in order monitor test method invocation
@aspect public class testaspect { @pointcut("@annotation(org.junit.test)") public void pointcut() { } @after("pointcut()") public void monitor() { system.out.println("*** after test ***"); } }
config :
@configuration @importresource("classpath:context.xml") public class integrationtestconfig { @bean public testaspect testaspect() { return new testaspect(); } }
but monitor method has not been invoked, what's wrong? - can advice test methods?? want know test method has been invoked.
junit has rules can used this.
Comments
Post a Comment