Skip to content

Commit ea7cfc8

Browse files
committed
Add test for @ResourceLock exclusive resource collection
Signed-off-by: raccoonback <[email protected]>
1 parent d8012d0 commit ea7cfc8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

jupiter-tests/src/test/java/org/junit/jupiter/engine/ClassTemplateInvocationTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import org.junit.platform.engine.UniqueId;
9797
import org.junit.platform.engine.discovery.DiscoverySelectors;
9898
import org.junit.platform.engine.reporting.ReportEntry;
99+
import org.junit.platform.engine.support.hierarchical.ExclusiveResource;
99100
import org.junit.platform.testkit.engine.EngineExecutionResults;
100101
import org.opentest4j.AssertionFailedError;
101102
import org.opentest4j.TestAbortedException;
@@ -1005,6 +1006,16 @@ void ignoresComposedAnnotations() {
10051006
assertThat(engineDescriptor.getDescendants()).isEmpty();
10061007
}
10071008

1009+
@Test
1010+
void classTemplateWithResourceLockCollectsExclusiveResources() {
1011+
var results = discoverTestsForClass(ClassTemplateWithResourceLockTestCase.class);
1012+
var classTemplateDescriptor = (ClassTemplateTestDescriptor) getOnlyElement(
1013+
results.getEngineDescriptor().getChildren());
1014+
1015+
assertThat(classTemplateDescriptor.getExclusiveResources()).extracting(
1016+
ExclusiveResource::getKey).containsExactly("test-resource");
1017+
}
1018+
10081019
@Test
10091020
void classTemplateWithResourceLockExecutesSuccessfully() {
10101021
var results = executeTestsForClass(ClassTemplateWithResourceLockTestCase.class);

0 commit comments

Comments
 (0)