Resolve warnings for Kotlin ByteArray. (#3521)

This commit is contained in:
Chris Rankin
2018-07-05 13:00:29 +01:00
committed by GitHub
parent 35b2170b9c
commit 02978fc174
7 changed files with 10 additions and 11 deletions

View File

@ -11,7 +11,7 @@ class PrivacySaltTest {
@Test
fun testValidSalt() {
PrivacySalt(ByteArray(SALT_SIZE, { 0x14 }))
PrivacySalt(ByteArray(SALT_SIZE) { 0x14 })
}
@Test
@ -22,13 +22,13 @@ class PrivacySaltTest {
@Test
fun testTooShortPrivacySalt() {
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE - 1, { 0x7f })) }
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE - 1) { 0x7f }) }
assertEquals("Privacy salt should be 32 bytes.", ex.message)
}
@Test
fun testTooLongPrivacySalt() {
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE + 1, { 0x7f })) }
val ex = assertFailsWith<IllegalArgumentException> { PrivacySalt(ByteArray(SALT_SIZE + 1) { 0x7f }) }
assertEquals("Privacy salt should be 32 bytes.", ex.message)
}
}

View File

@ -33,7 +33,7 @@ class SecureHashTest {
@Test
fun testConstants() {
assertArrayEquals(SecureHash.zeroHash.bytes, ByteArray(32))
assertArrayEquals(SecureHash.allOnesHash.bytes, ByteArray(32, { 0xFF.toByte() }))
assertArrayEquals(SecureHash.allOnesHash.bytes, ByteArray(32) { 0xFF.toByte() })
}
}