26 lines
1.2 KiB
Plaintext
26 lines
1.2 KiB
Plaintext
Captured from a real `junit-platform-console-standalone --details=tree` run against
|
|
ConvertWithTest, compiled and executed for real.
|
|
|
|
╷
|
|
├─ JUnit Platform Suite ✔
|
|
├─ JUnit Jupiter ✔
|
|
│ └─ ConvertWithTest ✔
|
|
│ └─ testDatesAreIn2023(LocalDate) ✔
|
|
│ ├─ date "2023-01-01" should be in 2023 ✔
|
|
│ ├─ date "2023-06-15" should be in 2023 ✔
|
|
│ └─ date "2023-12-31" should be in 2023 ✔
|
|
└─ JUnit Vintage ✔
|
|
|
|
Test run finished after 146 ms
|
|
[ 3 tests successful ]
|
|
[ 0 tests failed ]
|
|
|
|
The @ValueSource arguments are plain ISO-format date strings; @ConvertWith(DashDateConverter.class)
|
|
is what turns each one into a real java.time.LocalDate before the test method ever sees it, via
|
|
DashDateConverter's own SimpleArgumentConverter.convert() override. JUnit actually has an
|
|
implicit String-to-LocalDate conversion for this exact ISO shape, so this particular example
|
|
would work without @ConvertWith too -- it's shown here because the same mechanism is what you
|
|
reach for once the source strings need a format or extra validation JUnit's implicit converters
|
|
don't cover, and DashDateConverter.java is the smallest possible shape to build that converter
|
|
in when the need arises.
|