Created
October 3, 2018 17:36
-
-
Save pramoth/a92213acd7f10a9a56304c5f60aa4cb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LocalDate expectDate = LocalDate.of(2018,9,10); | |
| DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder() | |
| .appendOptional(DateTimeFormatter.ofPattern("yyyy M d")) | |
| .appendOptional(DateTimeFormatter.ofPattern("d M yyyy")) | |
| .appendOptional(DateTimeFormatter.ofPattern("d.M.yyyy")) | |
| .appendOptional(DateTimeFormatter.ofPattern("d/M/yyyy")) | |
| .toFormatter(); | |
| assertThat(LocalDate.parse("2018 09 10",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10 9 2018",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10.09.2018",dateTimeFormatter)).isEqualTo(expectDate); | |
| assertThat(LocalDate.parse("10/9/2018",dateTimeFormatter)).isEqualTo(expectDate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment