File tree 1 file changed +4
-8
lines changed
src/test/groovy/ru/mystamps/web/feature/site
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 17
17
*/
18
18
package ru.mystamps.web.feature.site
19
19
20
+ import static org.assertj.core.util.DateUtil.yesterday
21
+
20
22
import org.assertj.core.api.WithAssertions
21
23
import org.slf4j.helpers.NOPLogger
22
24
import ru.mystamps.web.feature.account.UserService
@@ -62,21 +64,15 @@ class LegacyCronServiceImplTest extends Specification implements WithAssertions
62
64
.hasMillisecond(0 )
63
65
}
64
66
65
- private static void assertDatesEqual (Date first , Date second ) {
66
- assert first[Calendar . YEAR ] == second[Calendar . YEAR ]
67
- assert first[Calendar . MONTH ] == second[Calendar . MONTH ]
68
- assert first[Calendar . DAY_OF_MONTH ] == second[Calendar . DAY_OF_MONTH ]
69
- }
70
-
71
67
private void assertMidnightOfYesterday (Date date ) {
72
68
assertThat (date). isNotNull()
73
- assertDatesEqual (date, new Date () . previous ())
69
+ assertThat (date) . isInSameDayAs(yesterday ())
74
70
assertMidnight(date)
75
71
}
76
72
77
73
private void assertMidnightOfToday (Date date ) {
78
74
assertThat (date). isNotNull()
79
- assertDatesEqual (date, new Date () )
75
+ assertThat (date) . isToday( )
80
76
assertMidnight(date)
81
77
}
82
78
You can’t perform that action at this time.
0 commit comments