@@ -70,7 +70,9 @@ public void testMetadataTryGetMethod() {
7070 metadata .put ("intKey" , 123 );
7171 metadata .put ("boolKey" , true );
7272 metadata .put ("uuidKey" , UUID .fromString ("00000000-0000-0000-0000-000000000001" ));
73- metadata .put ("instantKey" , Instant .parse ("2023-01-01T00:00:00Z" ));
73+
74+ Instant instant = Instant .parse ("2023-01-01T00:00:00Z" );
75+ metadata .put ("instantKey" , instant );
7476
7577 // Test tryGet method with direct type match
7678 Optional <String > stringResult = metadata .tryGet ("stringKey" , String .class );
@@ -87,7 +89,11 @@ public void testMetadataTryGetMethod() {
8789 Optional <Integer > stringIntResult = metadata .tryGet ("stringIntKey" , Integer .class );
8890 Assertions .assertTrue (stringIntResult .isPresent ());
8991 Assertions .assertEquals (456 , stringIntResult .get ());
90-
92+
93+ Optional <Instant > instantResult = metadata .tryGet ("instantKey" , Instant .class );
94+ Assertions .assertTrue (instantResult .isPresent ());
95+ Assertions .assertEquals (instant , instantResult .get ());
96+
9197 // Test tryGet method with a non-existent key
9298 Optional <String > nonExistentResult = metadata .tryGet ("nonExistentKey" , String .class );
9399 Assertions .assertFalse (nonExistentResult .isPresent ());
0 commit comments