-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Introduce more context into test callbacks
- Loading branch information
Showing
7 changed files
with
81 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ckito/src/main/java/io/quarkus/test/junit/mockito/internal/ResetMockitoMocksCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package io.quarkus.test.junit.mockito.internal; | ||
|
||
import io.quarkus.test.junit.callback.QuarkusTestAfterEachCallback; | ||
import io.quarkus.test.junit.callback.QuarkusTestMethodContext; | ||
|
||
public class ResetMockitoMocksCallback implements QuarkusTestAfterEachCallback { | ||
|
||
@Override | ||
public void afterEach(Object testInstance) { | ||
MockitoMocksTracker.reset(testInstance); | ||
public void afterEach(QuarkusTestMethodContext context) { | ||
MockitoMocksTracker.reset(context.getTestInstance()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...amework/junit5/src/main/java/io/quarkus/test/junit/callback/QuarkusTestMethodContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.quarkus.test.junit.callback; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Context object passed to {@link QuarkusTestBeforeEachCallback} and {@link QuarkusTestAfterEachCallback} | ||
*/ | ||
public final class QuarkusTestMethodContext { | ||
|
||
private final Object testInstance; | ||
private final Method testMethod; | ||
|
||
public QuarkusTestMethodContext(Object testInstance, Method testMethod) { | ||
this.testInstance = testInstance; | ||
this.testMethod = testMethod; | ||
} | ||
|
||
public Object getTestInstance() { | ||
return testInstance; | ||
} | ||
|
||
public Method getTestMethod() { | ||
return testMethod; | ||
} | ||
} |