Merge pull request #4 from rillig/fix-date-comparison-in-tests
Fix date comparison in JpaCityServiceTest
This commit is contained in:
commit
0b8d94c670
1 changed files with 5 additions and 2 deletions
|
@ -94,6 +94,8 @@ internal class JpaCityServiceTest {
|
|||
fun `'updateCity' should update existing values`() {
|
||||
val existingCity = repository.save(CityEntity("city", "cityname", "description", Coordinate(1.0, -1.0))).toDto()
|
||||
|
||||
Thread.sleep(1)
|
||||
|
||||
val result = service.updateCity(existingCity.id, UpdateCityDto("new name", "new description", CoordinateDto(-1.0, -1.0)))
|
||||
|
||||
softly.assertThat(result).isNotNull
|
||||
|
@ -102,7 +104,6 @@ internal class JpaCityServiceTest {
|
|||
softly.assertThat(result?.description).isEqualTo("new description")
|
||||
softly.assertThat(result?.location).isEqualTo(CoordinateDto(-1.0, -1.0))
|
||||
softly.assertThat(result?.updatedAt).isAfter(existingCity.updatedAt)
|
||||
softly.assertThat(result?.updatedAt).isAfter(existingCity.updatedAt)
|
||||
softly.assertThat(result?.createdAt).isEqualTo(existingCity.createdAt)
|
||||
}
|
||||
|
||||
|
@ -115,6 +116,8 @@ internal class JpaCityServiceTest {
|
|||
location = Coordinate(1.0, -1.0),
|
||||
updatedAt = LocalDateTime.now().minusYears(1))).toDto()
|
||||
|
||||
Thread.sleep(1)
|
||||
|
||||
val result = service.updateCity(existingCity.id, UpdateCityDto(null, null, null))
|
||||
|
||||
softly.assertThat(result).isNotNull
|
||||
|
|
Loading…
Reference in a new issue