From 80011759f5877f4f4022b0793eb50b4e4e6532c9 Mon Sep 17 00:00:00 2001 From: Ryan Haining Date: Sat, 23 Sep 2023 16:14:13 -0700 Subject: [PATCH] Replaces EncryptedPrefsFormatTest assertThrows with assertFailsWith Related to #2745 --- .../maintenance/formats/EncryptedPrefsFormatTest.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt b/plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt index 5b65a6aace..99b2bea211 100644 --- a/plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt +++ b/plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/formats/EncryptedPrefsFormatTest.kt @@ -17,6 +17,7 @@ import org.mockito.ArgumentMatchers import org.mockito.Mock import org.mockito.Mockito import java.io.File +import kotlin.test.assertFailsWith // https://stackoverflow.com/questions/52344522/joseexception-couldnt-create-aes-gcm-nopadding-cipher-illegal-key-size // https://stackoverflow.com/questions/47708951/can-aes-256-work-on-android-devices-with-api-level-26 @@ -208,7 +209,7 @@ open class EncryptedPrefsFormatTest : TestBase() { @Test fun garbageInputTest() { - Assertions.assertThrows(PrefFormatError::class.java) { + assertFailsWith { val frozenPrefs = "whatever man, i duno care" val storage = SingleStringStorage(frozenPrefs) @@ -219,7 +220,7 @@ open class EncryptedPrefsFormatTest : TestBase() { @Test fun unknownFormatTest() { - Assertions.assertThrows(PrefFormatError::class.java) { + assertFailsWith { val frozenPrefs = "{\n" + " \"metadata\": {},\n" + " \"security\": {\n" +