fixes in tests

This commit is contained in:
InsanusMokrassar 2021-06-03 12:37:13 +06:00
parent c3ed1d024c
commit fec17f949f
2 changed files with 5 additions and 5 deletions

View File

@ -28,10 +28,10 @@ internal class CommonNearDateTimeCalculator<T>(
): Pair<DateTime, Boolean>? { ): Pair<DateTime, Boolean>? {
val currentData = partGetter(relativelyTo) val currentData = partGetter(relativelyTo)
val greaterOrEquals = times.firstOrNull { it >= currentData } val greaterOrEquals = times.firstOrNull { it >= currentData }
val newDateTime = if (greaterOrEquals == null) { val newDateTime = when (greaterOrEquals) {
partSetter(relativelyTo, times.first()) ?: return null null -> partSetter(relativelyTo, times.first()) ?: return null
} else { currentData -> relativelyTo
partSetter(relativelyTo, greaterOrEquals) ?: return null else -> partSetter(relativelyTo, greaterOrEquals) ?: return null
} }
return if (newDateTime == relativelyTo) { return if (newDateTime == relativelyTo) {
relativelyTo to false relativelyTo to false

View File

@ -80,7 +80,7 @@ class StringParseTest {
} }
@Test @Test
fun testThatTimezoneCorrectlyDeserialized() { fun testThatTimezoneCorrectlyDeserialized() {
val now = DateTimeTz.nowLocal() val now = DateTime.now().copy(milliseconds = 0).local
runTest { runTest {
for (i in 0 .. 1339) { for (i in 0 .. 1339) {