parent
343e2fe6fb
commit
392cd48ff5
1 changed files with 12 additions and 12 deletions
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.plugins.constraints.dstHelper
|
||||
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -41,31 +41,31 @@ class DstHelperPluginTest : TestBase() {
|
|||
val df: DateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ITALIAN)
|
||||
var dateBeforeDST = df.parse("2018-03-25 01:55")
|
||||
cal.time = dateBeforeDST!!
|
||||
Assertions.assertEquals(false, plugin.wasDST(cal))
|
||||
Assertions.assertEquals(true, plugin.willBeDST(cal))
|
||||
assertThat(plugin.wasDST(cal)).isFalse()
|
||||
assertThat(plugin.willBeDST(cal)).isTrue()
|
||||
TimeZone.setDefault(tz)
|
||||
cal = Calendar.getInstance(tz, Locale.ITALIAN)
|
||||
dateBeforeDST = df.parse("2018-03-25 03:05")
|
||||
cal.time = dateBeforeDST!!
|
||||
Assertions.assertEquals(true, plugin.wasDST(cal))
|
||||
Assertions.assertEquals(false, plugin.willBeDST(cal))
|
||||
assertThat(plugin.wasDST(cal)).isTrue()
|
||||
assertThat(plugin.willBeDST(cal)).isFalse()
|
||||
TimeZone.setDefault(tz)
|
||||
cal = Calendar.getInstance(tz, Locale.ITALIAN)
|
||||
dateBeforeDST = df.parse("2018-03-25 02:05") //Cannot happen!!!
|
||||
cal.time = dateBeforeDST!!
|
||||
Assertions.assertEquals(true, plugin.wasDST(cal))
|
||||
Assertions.assertEquals(false, plugin.willBeDST(cal))
|
||||
assertThat(plugin.wasDST(cal)).isTrue()
|
||||
assertThat(plugin.willBeDST(cal)).isFalse()
|
||||
TimeZone.setDefault(tz)
|
||||
cal = Calendar.getInstance(tz, Locale.ITALIAN)
|
||||
dateBeforeDST = df.parse("2018-03-25 05:55") //Cannot happen!!!
|
||||
cal.time = dateBeforeDST!!
|
||||
Assertions.assertEquals(true, plugin.wasDST(cal))
|
||||
Assertions.assertEquals(false, plugin.willBeDST(cal))
|
||||
assertThat(plugin.wasDST(cal)).isTrue()
|
||||
assertThat(plugin.willBeDST(cal)).isFalse()
|
||||
TimeZone.setDefault(tz)
|
||||
cal = Calendar.getInstance(tz, Locale.ITALIAN)
|
||||
dateBeforeDST = df.parse("2018-03-25 06:05") //Cannot happen!!!
|
||||
cal.time = dateBeforeDST!!
|
||||
Assertions.assertEquals(false, plugin.wasDST(cal))
|
||||
Assertions.assertEquals(false, plugin.willBeDST(cal))
|
||||
assertThat(plugin.wasDST(cal)).isFalse()
|
||||
assertThat(plugin.willBeDST(cal)).isFalse()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue