Skip to content

Commit 9dd4811

Browse files
committed
Fix tests (2)
1 parent 6aa17b1 commit 9dd4811

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

lib/src/test/java/at/bitfire/cert4android/CustomCertManagerTest.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ class CustomCertManagerTest {
3636
@Before
3737
fun createCertManager() {
3838
certStore = TestCertStore()
39-
certManager = CustomCertManager(certStore, true, null)
40-
paranoidCertManager = CustomCertManager(certStore, false, null)
39+
certManager = CustomCertManager(certStore, object : SettingsProvider {
40+
override val appInForeground = null
41+
override val trustSystemCerts = true
42+
})
43+
paranoidCertManager = CustomCertManager(certStore, object : SettingsProvider {
44+
override val appInForeground = null
45+
override val trustSystemCerts = false
46+
})
4147
}
4248

4349

lib/src/test/java/at/bitfire/cert4android/TestCertStore.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
package at.bitfire.cert4android
1212

1313
import androidx.annotation.VisibleForTesting
14-
import kotlinx.coroutines.flow.StateFlow
1514
import java.security.cert.X509Certificate
1615
import java.util.logging.Level
1716
import java.util.logging.Logger
@@ -43,7 +42,7 @@ class TestCertStore: CertStore {
4342
/**
4443
* Determines whether a certificate chain is trusted.
4544
*/
46-
override fun isTrusted(chain: Array<X509Certificate>, authType: String, trustSystemCerts: Boolean, appInForeground: StateFlow<Boolean>?): Boolean {
45+
override fun isTrusted(chain: Array<X509Certificate>, authType: String, trustSystemCerts: Boolean, appInForeground: Boolean?): Boolean {
4746
if (chain.isEmpty())
4847
throw IllegalArgumentException("Certificate chain must not be empty")
4948
val cert = chain[0]

0 commit comments

Comments
 (0)