parent
2d8b1ecd90
commit
e83d83b350
1 changed files with 7 additions and 7 deletions
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.plugins.constraints.objectives
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
import kotlin.math.abs
|
||||
|
@ -16,16 +16,16 @@ class SntpClientTest : TestBase() {
|
|||
// no internet
|
||||
SntpClient(aapsLogger, dateUtil).ntpTime(object : SntpClient.Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertFalse(networkConnected)
|
||||
Assertions.assertFalse(success)
|
||||
Assertions.assertEquals(0L, time)
|
||||
assertThat(networkConnected).isFalse()
|
||||
assertThat(success).isFalse()
|
||||
assertThat(time).isEqualTo(0L)
|
||||
}
|
||||
}, false)
|
||||
// internet
|
||||
SntpClient(aapsLogger, dateUtil).doNtpTime(object : SntpClient.Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(success)
|
||||
Assertions.assertTrue(abs(time - System.currentTimeMillis()) < 60000)
|
||||
assertThat(success).isTrue()
|
||||
assertThat(abs(time - System.currentTimeMillis())).isLessThan(60_000L)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue