@@ -70,7 +70,9 @@ public void testMetadataTryGetMethod() {
70
70
metadata .put ("intKey" , 123 );
71
71
metadata .put ("boolKey" , true );
72
72
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 );
74
76
75
77
// Test tryGet method with direct type match
76
78
Optional <String > stringResult = metadata .tryGet ("stringKey" , String .class );
@@ -87,7 +89,11 @@ public void testMetadataTryGetMethod() {
87
89
Optional <Integer > stringIntResult = metadata .tryGet ("stringIntKey" , Integer .class );
88
90
Assertions .assertTrue (stringIntResult .isPresent ());
89
91
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
+
91
97
// Test tryGet method with a non-existent key
92
98
Optional <String > nonExistentResult = metadata .tryGet ("nonExistentKey" , String .class );
93
99
Assertions .assertFalse (nonExistentResult .isPresent ());
0 commit comments