Skip to content

Commit

Permalink
fix junit4 aspect for gradle tests (via #111)
Browse files Browse the repository at this point in the history
  • Loading branch information
eroshenkoam authored and baev committed Jul 19, 2017
1 parent 2326f91 commit 7080741
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.qameta.allure.junit4;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.junit.runner.notification.RunNotifier;

Expand All @@ -12,8 +13,9 @@ public class AllureJunit4ListenerAspect {

private final AllureJunit4 allure = new AllureJunit4();

@AfterReturning(pointcut = "call(org.junit.runner.notification.RunNotifier.new(..))", returning = "notifier")
public void addListener(final RunNotifier notifier) {
@After("execution(org.junit.runner.notification.RunNotifier.new())")
public void addListener(final JoinPoint point) {
final RunNotifier notifier = (RunNotifier) point.getThis();
notifier.removeListener(allure);
notifier.addListener(allure);
}
Expand Down

0 comments on commit 7080741

Please sign in to comment.