Skip to content

Commit 7080741

Browse files
Artem Eroshenkobaev
authored andcommitted
fix junit4 aspect for gradle tests (via #111)
1 parent 2326f91 commit 7080741

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

allure-junit4-aspect/src/main/java/io/qameta/allure/junit4/AllureJunit4ListenerAspect.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.qameta.allure.junit4;
22

3-
import org.aspectj.lang.annotation.AfterReturning;
3+
import org.aspectj.lang.JoinPoint;
4+
import org.aspectj.lang.annotation.After;
45
import org.aspectj.lang.annotation.Aspect;
56
import org.junit.runner.notification.RunNotifier;
67

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

1314
private final AllureJunit4 allure = new AllureJunit4();
1415

15-
@AfterReturning(pointcut = "call(org.junit.runner.notification.RunNotifier.new(..))", returning = "notifier")
16-
public void addListener(final RunNotifier notifier) {
16+
@After("execution(org.junit.runner.notification.RunNotifier.new())")
17+
public void addListener(final JoinPoint point) {
18+
final RunNotifier notifier = (RunNotifier) point.getThis();
1719
notifier.removeListener(allure);
1820
notifier.addListener(allure);
1921
}

0 commit comments

Comments
 (0)