-
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.
Change default behavior of @WithTestResource
The new default @WithTestResource behavior is for Quarkus to NOT restart when consecutive tests are using the same @WithTestResource annotations.
- Loading branch information
Showing
8 changed files
with
156 additions
and
40 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
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
75 changes: 75 additions & 0 deletions
75
...-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerReloadTest.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,75 @@ | ||
package io.quarkus.test.common; | ||
|
||
import static io.quarkus.test.common.TestResourceManager.testResourcesRequireReload; | ||
import static io.quarkus.test.common.TestResourceScope.*; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.common.TestResourceManager.TestResourceComparisonInfo; | ||
|
||
public class TestResourceManagerReloadTest { | ||
|
||
@Test | ||
public void emptyResources() { | ||
assertFalse(testResourcesRequireReload(Collections.emptySet(), Set.of())); | ||
} | ||
|
||
@Test | ||
public void differentCount() { | ||
assertTrue(testResourcesRequireReload(Collections.emptySet(), | ||
Set.of(new TestResourceComparisonInfo("test", RESTRICTED_TO_CLASS)))); | ||
|
||
assertTrue(testResourcesRequireReload(Set.of(new TestResourceComparisonInfo("test", RESTRICTED_TO_CLASS)), | ||
Collections.emptySet())); | ||
} | ||
|
||
@Test | ||
public void sameSingleRestrictedToClassResource() { | ||
assertTrue(testResourcesRequireReload( | ||
Set.of(new TestResourceComparisonInfo("test", RESTRICTED_TO_CLASS)), | ||
Set.of(new TestResourceComparisonInfo("test", RESTRICTED_TO_CLASS)))); | ||
} | ||
|
||
@Test | ||
public void sameSingleMatchingResource() { | ||
assertFalse(testResourcesRequireReload( | ||
Set.of(new TestResourceComparisonInfo("test", MATCHING_RESOURCE)), | ||
Set.of(new TestResourceComparisonInfo("test", MATCHING_RESOURCE)))); | ||
} | ||
|
||
@Test | ||
public void differentSingleMatchingResource() { | ||
assertTrue(testResourcesRequireReload( | ||
Set.of(new TestResourceComparisonInfo("test", MATCHING_RESOURCE)), | ||
Set.of(new TestResourceComparisonInfo("test2", MATCHING_RESOURCE)))); | ||
} | ||
|
||
@Test | ||
public void sameMultipleMatchingResource() { | ||
assertFalse(testResourcesRequireReload( | ||
Set.of( | ||
new TestResourceComparisonInfo("test", MATCHING_RESOURCE), | ||
new TestResourceComparisonInfo("test2", MATCHING_RESOURCE), | ||
new TestResourceComparisonInfo("test3", GLOBAL)), | ||
Set.of(new TestResourceComparisonInfo("test3", GLOBAL), | ||
new TestResourceComparisonInfo("test2", MATCHING_RESOURCE), | ||
new TestResourceComparisonInfo("test", MATCHING_RESOURCE)))); | ||
} | ||
|
||
@Test | ||
public void differentMultipleMatchingResource() { | ||
assertTrue(testResourcesRequireReload( | ||
Set.of( | ||
new TestResourceComparisonInfo("test", MATCHING_RESOURCE), | ||
new TestResourceComparisonInfo("test2", MATCHING_RESOURCE), | ||
new TestResourceComparisonInfo("test3", GLOBAL)), | ||
Set.of(new TestResourceComparisonInfo("test3", GLOBAL), | ||
new TestResourceComparisonInfo("test2", MATCHING_RESOURCE), | ||
new TestResourceComparisonInfo("TEST", MATCHING_RESOURCE)))); | ||
} | ||
} |
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