MULE-6826: Fix flaky unit test: DateTimeTestCase

Also fixed other test cases with similar problems.
(cherry picked from commit c7a1c19)