Rewrites StringLengthPrefixEncodingTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-10-08 19:14:54 -07:00
parent 22b6f75444
commit 5d4c0f7243

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
import app.aaps.core.utils.toHex import app.aaps.core.utils.toHex
import com.google.common.truth.Truth.assertThat
import com.google.crypto.tink.subtle.Hex import com.google.crypto.tink.subtle.Hex
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class StringLengthPrefixEncodingTest { class StringLengthPrefixEncodingTest {
@ -12,12 +12,12 @@ class StringLengthPrefixEncodingTest {
@Test fun testFormatKeysP0() { @Test fun testFormatKeysP0() {
val payload = StringLengthPrefixEncoding.formatKeys(arrayOf("P0="), arrayOf(p0Content)) val payload = StringLengthPrefixEncoding.formatKeys(arrayOf("P0="), arrayOf(p0Content))
Assertions.assertEquals(p0Payload.toHex(), payload.toHex()) assertThat(p0Payload.toHex()).isEqualTo(payload.toHex())
} }
@Test fun testParseKeysP0() { @Test fun testParseKeysP0() {
val parsed = StringLengthPrefixEncoding.parseKeys(arrayOf("P0="), p0Payload) val parsed = StringLengthPrefixEncoding.parseKeys(arrayOf("P0="), p0Payload)
Assertions.assertEquals(parsed.size, 1) assertThat(parsed).hasLength(1)
Assertions.assertEquals(parsed[0].toHex(), p0Content.toHex()) assertThat(parsed[0].toHex()).isEqualTo(p0Content.toHex())
} }
} }