|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+package se.citerus.dddsample;
|
|
|
2
|
+
|
|
|
3
|
+import java.text.ParseException;
|
|
|
4
|
+import java.text.SimpleDateFormat;
|
|
|
5
|
+import java.util.Date;
|
|
|
6
|
+
|
|
|
7
|
+/**
|
|
|
8
|
+ * A few utils for working with Date in tests.
|
|
|
9
|
+ *
|
|
|
10
|
+ */
|
|
|
11
|
+public class DateTestUtil {
|
|
|
12
|
+
|
|
|
13
|
+ public static Date toDate(String date) {
|
|
|
14
|
+ return toDate(date, "00:00.00.000");
|
|
|
15
|
+ }
|
|
|
16
|
+
|
|
|
17
|
+ public static Date toDate(String date, String time) {
|
|
|
18
|
+ try {
|
|
|
19
|
+ return new SimpleDateFormat("yyyy-MM-dd hh:mm").parse(date + " " + time);
|
|
|
20
|
+ } catch (ParseException e) {
|
|
|
21
|
+ throw new RuntimeException(e);
|
|
|
22
|
+ }
|
|
|
23
|
+ }
|
|
|
24
|
+
|
|
|
25
|
+}
|