From c448b88a33cdce72a82e154fdaa652cda2ee4563 Mon Sep 17 00:00:00 2001 From: yuxin Date: Fri, 26 Apr 2024 18:26:54 +0100 Subject: [PATCH] Fixing --- ...iveAuthPublicClientApplicationKotlinTest.kt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/msal/src/test/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplicationKotlinTest.kt b/msal/src/test/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplicationKotlinTest.kt index b31ab7578..931cc9ac0 100644 --- a/msal/src/test/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplicationKotlinTest.kt +++ b/msal/src/test/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplicationKotlinTest.kt @@ -79,6 +79,7 @@ import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.argThat +import org.mockito.ArgumentMatchers.contains import org.mockito.Mock import org.mockito.Mockito import org.mockito.MockitoAnnotations @@ -197,26 +198,19 @@ class NativeAuthPublicClientApplicationKotlinTest : PublicClientApplicationAbstr val result = application.signIn(username, password) - checkingSafeLogging() + checkSafeLogging() assertTrue(result is SignInResult.Complete) } - private fun checkingSafeLogging() { + private fun checkSafeLogging() { val elementsToCheck = listOf("username", "password") elementsToCheck.forEach { element -> - verifyLogContains(element) + verifyLogDoesNotContain(element) } } - // Custom matcher function to check if a list contains a certain element - private fun verifyLogContains(element: String) { - verify(externalLogger, never()).log(any(), any(), containsElement(element), eq(true)) - } - - private fun containsElement(element: String): String { - return argThat { - it.contains(element) - } + private fun verifyLogDoesNotContain(element: String) { + verify(externalLogger, never()).log(any(), any(), contains(element), eq(true)) } /**