Added checking of empty date. Also added unit tests for exceptions.