|
6 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
7 | 7 | import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
8 | 8 | import static org.junit.jupiter.api.Assertions.assertNotNull;
|
| 9 | +import static org.junit.jupiter.api.Assertions.assertNull; |
9 | 10 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
10 | 11 | import static org.mockito.ArgumentMatchers.any;
|
11 | 12 | import static org.mockito.Mockito.doThrow;
|
@@ -801,4 +802,28 @@ void doesnt_use_finally() {
|
801 | 802 | Hook.class.getMethod("finallyAfter", HookContext.class, FlagEvaluationDetails.class, Map.class))
|
802 | 803 | .doesNotThrowAnyException();
|
803 | 804 | }
|
| 805 | + |
| 806 | + @Specification( |
| 807 | + number = "4.6.1", |
| 808 | + text = "hook data MUST be a structure supporting the definition of arbitrary " |
| 809 | + + "properties, with keys of type string, and values of any type.") |
| 810 | + @Test |
| 811 | + void hook_data_structure() { |
| 812 | + // Arrange |
| 813 | + HookData hookData = new DefaultHookData(); |
| 814 | + |
| 815 | + // Act - Add arbitrary properties to hook data |
| 816 | + hookData.set("stringKey", "StringValue"); // String value |
| 817 | + hookData.set("intKey", 42); // Integer value |
| 818 | + hookData.set("doubleKey", 3.14); // Double value |
| 819 | + hookData.set("objectKey", new Object()); // Object value |
| 820 | + hookData.set("nullKey", null); // Null value |
| 821 | + |
| 822 | + // Assert - Retrieve and validate the properties |
| 823 | + assertEquals("StringValue", hookData.get("stringKey")); |
| 824 | + assertEquals(42, hookData.get("intKey")); |
| 825 | + assertEquals(3.14, hookData.get("doubleKey")); |
| 826 | + assertNotNull(hookData.get("objectKey")); |
| 827 | + assertNull(hookData.get("nullKey")); |
| 828 | + } |
804 | 829 | }
|
0 commit comments