You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using mock for dateTimeProvider may side affect users test that use dateTimeProvider. To avoid side affect we need to use @MockBean
Motivation for or Use Case
I have my own integration tests, which use the createdDate, lastModifiedDate in the verification of business logic. I was a bit confused when my tests fell and saw that the createdDate, lastModifiedDate in my objects equals Instant.now() - minus 4 days. The reason for this is using @mock DateTimeProvider in UserServiceIT.
Reproduce the error
Create a test in which an object with the createdDate, lastModifiedDate will be created.
Compare createdDate, lastModifiedDate with current date.
Expected result: createdDate, lastModifiedDate have Instant.now() value Actual result: createdDate, lastModifiedDate have Instant.now() - 4 days value
Overview of the issue
Using mock for dateTimeProvider may side affect users test that use dateTimeProvider. To avoid side affect we need to use @MockBean
Motivation for or Use Case
I have my own integration tests, which use the createdDate, lastModifiedDate in the verification of business logic. I was a bit confused when my tests fell and saw that the createdDate, lastModifiedDate in my objects equals Instant.now() - minus 4 days. The reason for this is using @mock DateTimeProvider in UserServiceIT.
Reproduce the error
Expected result: createdDate, lastModifiedDate have Instant.now() value
Actual result: createdDate, lastModifiedDate have Instant.now() - 4 days value
Related issues
n/a
Link to PR (if any)
#247
KHipster Version(s)
1.8.1
The text was updated successfully, but these errors were encountered: