Skip to content

Commit f1db733

Browse files
committed
Test parent relationships
1 parent 3fdd74c commit f1db733

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,22 @@ public int hashCode() {
478478
@Nested
479479
class InheritedValuesTests {
480480

481+
@SuppressWarnings("deprecation")
481482
@Test
482-
void valueFromParentIsVisible() {
483+
void presentValueFromParentIsPresent() {
483484
parentStore.put(namespace, key, value);
484485
assertEquals(value, store.get(namespace, key));
486+
assertEquals(value, store.getOrComputeIfAbsent(namespace, key, __ -> "enigma"));
487+
assertEquals(value, store.computeIfAbsent(namespace, key, __ -> "enigma"));
488+
}
489+
490+
@SuppressWarnings("deprecation")
491+
@Test
492+
void absentValueFromParentIsOverriddenByComputeIfAbsent() {
493+
parentStore.put(namespace, key, null);
494+
assertNull(store.get(namespace, key));
495+
assertNull(store.getOrComputeIfAbsent(namespace, key, __ -> value));
496+
assertEquals(value, store.computeIfAbsent(namespace, key, __ -> value));
485497
}
486498

487499
@Test

0 commit comments

Comments
 (0)