forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clear outer instances when init test state is called
The init test state is called several times depending whether JUnit 5 is configured with the lifecycle method based or class based. Clearing out the outer instances every time the main class is initialized, ensure that the outer instances are always up to date.
- Loading branch information
Showing
9 changed files
with
83 additions
and
8 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
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
18 changes: 18 additions & 0 deletions
18
...ation-tests/main/src/test/java/io/quarkus/it/main/TestContextCheckerAfterAllCallback.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,18 @@ | ||
package io.quarkus.it.main; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import io.quarkus.test.junit.callback.QuarkusTestAfterAllCallback; | ||
import io.quarkus.test.junit.callback.QuarkusTestContext; | ||
|
||
public class TestContextCheckerAfterAllCallback implements QuarkusTestAfterAllCallback { | ||
|
||
public static final List<Object> OUTER_INSTANCES = new ArrayList<>(); | ||
|
||
@Override | ||
public void afterAll(QuarkusTestContext context) { | ||
OUTER_INSTANCES.clear(); | ||
OUTER_INSTANCES.addAll(context.getOuterInstances()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...tion-tests/main/src/test/java/io/quarkus/it/main/TestContextCheckerAfterEachCallback.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,18 @@ | ||
package io.quarkus.it.main; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import io.quarkus.test.junit.callback.QuarkusTestAfterEachCallback; | ||
import io.quarkus.test.junit.callback.QuarkusTestMethodContext; | ||
|
||
public class TestContextCheckerAfterEachCallback implements QuarkusTestAfterEachCallback { | ||
|
||
public static final List<Object> OUTER_INSTANCES = new ArrayList<>(); | ||
|
||
@Override | ||
public void afterEach(QuarkusTestMethodContext context) { | ||
OUTER_INSTANCES.clear(); | ||
OUTER_INSTANCES.addAll(context.getOuterInstances()); | ||
} | ||
} |
10 changes: 8 additions & 2 deletions
10
...eAnnotationCheckerBeforeEachCallback.java → ...TestContextCheckerBeforeEachCallback.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
1 change: 1 addition & 0 deletions
1
...st/resources/META-INF/services/io.quarkus.test.junit.callback.QuarkusTestAfterAllCallback
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 @@ | ||
io.quarkus.it.main.TestContextCheckerAfterAllCallback |
1 change: 1 addition & 0 deletions
1
...t/resources/META-INF/services/io.quarkus.test.junit.callback.QuarkusTestAfterEachCallback
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 @@ | ||
io.quarkus.it.main.TestContextCheckerAfterEachCallback |
2 changes: 1 addition & 1 deletion
2
.../resources/META-INF/services/io.quarkus.test.junit.callback.QuarkusTestBeforeEachCallback
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 +1 @@ | ||
io.quarkus.it.main.SimpleAnnotationCheckerBeforeEachCallback | ||
io.quarkus.it.main.TestContextCheckerBeforeEachCallback |
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