1 package se.citerus.dddsample.application.util;
2
3 import java.text.ParseException;
4 import java.text.SimpleDateFormat;
5 import java.util.Date;
6
7
8
9
10
11 public final class DateTestUtil {
12
13
14
15
16
17 public static Date toDate(final String date) {
18 return toDate(date, "00:00.00.000");
19 }
20
21
22
23
24
25
26 public static Date toDate(final String date, final String time) {
27 try {
28 return new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(date + " " + time);
29 } catch (ParseException e) {
30 throw new RuntimeException(e);
31 }
32 }
33
34
35
36
37 private DateTestUtil() {
38 }
39 }