|
16 | 16 |
|
17 | 17 | package org.springframework.boot.actuate.context.properties; |
18 | 18 |
|
| 19 | +import java.time.Duration; |
19 | 20 | import java.util.ArrayList; |
20 | 21 | import java.util.Arrays; |
21 | 22 | import java.util.Collections; |
@@ -157,6 +158,16 @@ public void mixedCase() { |
157 | 158 | }); |
158 | 159 | } |
159 | 160 |
|
| 161 | + @Test |
| 162 | + public void duration() { |
| 163 | + load((context, properties) -> { |
| 164 | + Map<String, Object> nestedProperties = properties.getBeans() |
| 165 | + .get("testProperties").getProperties(); |
| 166 | + assertThat(nestedProperties.get("duration")) |
| 167 | + .isEqualTo(Duration.ofSeconds(10).toString()); |
| 168 | + }); |
| 169 | + } |
| 170 | + |
160 | 171 | @Test |
161 | 172 | public void singleLetterProperty() { |
162 | 173 | load((context, properties) -> { |
@@ -276,6 +287,8 @@ public static class TestProperties { |
276 | 287 |
|
277 | 288 | private String nullValue = null; |
278 | 289 |
|
| 290 | + private Duration duration = Duration.ofSeconds(10); |
| 291 | + |
279 | 292 | public TestProperties() { |
280 | 293 | this.secrets.put("mine", "myPrivateThing"); |
281 | 294 | this.secrets.put("yours", "yourPrivateThing"); |
@@ -379,6 +392,14 @@ public void setNullValue(String nullValue) { |
379 | 392 | this.nullValue = nullValue; |
380 | 393 | } |
381 | 394 |
|
| 395 | + public Duration getDuration() { |
| 396 | + return this.duration; |
| 397 | + } |
| 398 | + |
| 399 | + public void setDuration(Duration duration) { |
| 400 | + this.duration = duration; |
| 401 | + } |
| 402 | + |
382 | 403 | public static class Hidden { |
383 | 404 |
|
384 | 405 | private String mine = "mySecret"; |
|
0 commit comments