- I need to first create a String representing the current date.
- Afterwards this String needs to be parsed and used to build an instance of the Date class.
In my test class I create a current date as a String input for my tested method in the following manner:
String inputDate = date.today().format(); // 13:28:15:378 USER_DEBUG |DEBUG|17.3.2017
However, when I attempt to create an instance of a Date object like this:
Date dateFromInput = date.valueOf(inputDate);
I receive the following error:
13:28:15:398 FATAL_ERROR System.TypeException: Invalid date: 17.3.2017