Hey guys. I would like to carry out the validation of input from cmd in application responsbile for fetching rate data from national polish bank.
I need to input 3 arguments for example: EUR 2013-01-28 2013-01-31.
I need to validate two dates, 2 arguments with:
1) first date needs to be before next
2) input is in good pattern. I mean it cannot be 28-01-2013, it needs to be 2013-01-28.
Im using LocalDate.
For now, I am parsing String to LocalDate with LocalDate.parse, and it throws the DateTimeParseException when date is not correct, but I would like to log that exception and show message for example "You put date in wrong format". How can I do that? I have already interface called ConditionChecker that looks like this:
My main looks like this:
Currency validation is also in main, but it looks fine, no try/catch blocks etc and I want to achieve same thing with LocalDate.
Returning to localdates validation. It should be in CondtionChecker or how should I make it?