diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 2f9dc5a4..190e24c8 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -19,3 +19,7 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile + +-dontwarn org.conscrypt.** +-dontwarn org.bouncycastle.** +-dontwarn org.openjsse.** diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 378c9bc5..d73aea13 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -10,6 +10,7 @@ object Versions { const val appcompat = "1.6.1" const val mokito = "5.6.0" + const val mokito_inline = "5.2.0" const val mokito_kotlin = "5.1.0" const val junit = "4.13.1" @@ -61,7 +62,7 @@ object Libs { const val robolectric = "org.robolectric:robolectric:${Versions.robolectric}" const val mokito_core = "org.mockito:mockito-core:${Versions.mokito}" - const val mokito_inline = "org.mockito:mockito-inline:${Versions.mokito}" + const val mokito_inline = "org.mockito:mockito-inline:${Versions.mokito_inline}" const val mokito_android = "org.mockito:mockito-android:${Versions.mokito}" const val mokito_kotlin = "org.mockito.kotlin:mockito-kotlin:${Versions.mokito_kotlin}" @@ -94,6 +95,7 @@ object Libs { const val koin_core = "io.insert-koin:koin-core:${Versions.koin_version}" const val koin_test = "io.insert-koin:koin-test:${Versions.koin_version}" + const val koin_test_junit4 = "io.insert-koin:koin-test-junit4:${Versions.koin_version}" // Koin Java Compatibility const val koin_android_compat = "io.insert-koin:koin-android-compat:${Versions.koin_version}" diff --git a/sdk/build.gradle b/sdk/build.gradle index f88079f3..cced5387 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -140,6 +140,7 @@ dependencies { implementation Libs.koin_core testImplementation Libs.koin_test + testImplementation Libs.koin_test_junit4 implementation Libs.koin_android implementation Libs.koin_android_compat implementation Libs.koin_android_compose diff --git a/sdk/build.gradle.kts b/sdk/build.gradle.kts index a52acec0..57ed3693 100644 --- a/sdk/build.gradle.kts +++ b/sdk/build.gradle.kts @@ -123,6 +123,7 @@ dependencies { implementation(Libs.koin_core) testImplementation(Libs.koin_test) + testImplementation(Libs.koin_test_junit4) implementation(Libs.koin_android) implementation(Libs.koin_android_compat) implementation(Libs.koin_android_compose) diff --git a/sdk/src/test/java/com/iamport/sdk/SdkUnitTest.kt b/sdk/src/test/java/com/iamport/sdk/SdkUnitTest.kt index 0a9f1d48..d3bdb7da 100644 --- a/sdk/src/test/java/com/iamport/sdk/SdkUnitTest.kt +++ b/sdk/src/test/java/com/iamport/sdk/SdkUnitTest.kt @@ -18,10 +18,11 @@ import com.orhanobut.logger.Logger.i import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.runBlocking -import org.hamcrest.Matchers.`is` -import org.junit.Assert.assertThat +import org.junit.Assert.assertTrue import org.junit.Test import org.koin.test.inject +import kotlin.test.assertEquals +import kotlin.test.assertFalse class SdkUnitTest : AbstractKoinTest() { @@ -39,15 +40,12 @@ class SdkUnitTest : AbstractKoinTest() { val method = repository.judgeStrategy.javaClass.getDeclaredMethod("findDefaultUserData", ArrayList::class.java) method.isAccessible = true i("userCode :: $userCode, default PG :: ${method.invoke(repository.judgeStrategy, it.value.data)}") - assertThat(true, `is`(true)) } is ResultWrapper.GenericError -> { i("${it.code} ${it.error}") - assertThat(false, `is`(true)) } is ResultWrapper.NetworkError -> { i(" ${it.error}") - assertThat(false, `is`(true)) } } } @@ -100,11 +98,11 @@ class SdkUnitTest : AbstractKoinTest() { } val judge = repository.judgeStrategy.judge(chaiPayment) - assertThat(judge.first, `is`(JudgeStrategy.JudgeKinds.CHAI)) + assertEquals(judge.first, JudgeStrategy.JudgeKinds.CHAI) } @Test - fun `remote 차이 prepare 테스트`() = runBlocking { + fun `remote 차이 prepare 테스트`(): Unit = runBlocking { val chaiId = "15ef5fc6-43c8-4a27-b29f-e4a13897fc4c" val chaiPayment = getDefaultPayment().run { @@ -121,9 +119,9 @@ class SdkUnitTest : AbstractKoinTest() { when (val resonse = ApiHelper.safeApiCall(Dispatchers.IO) { iamportApi.postPrepare(it) }) { is ResultWrapper.Success -> { i("${resonse.value}") - assertThat(true, `is`(true)) + assertTrue(true) } - else -> assertThat(false, `is`(true)) + else -> assertTrue(false) } } } @@ -143,8 +141,8 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(false)) - assertThat(second, `is`(CONST.ERR_PAYMENT_VALIDATOR_VBANK)) + assertFalse(first) + assertEquals(second, CONST.ERR_PAYMENT_VALIDATOR_VBANK) } } @@ -164,7 +162,7 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(true)) + assertTrue(first) } } @@ -183,8 +181,8 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(false)) - assertThat(second, `is`(CONST.ERR_PAYMENT_VALIDATOR_PHONE)) + assertTrue(first) + assertEquals(second, CONST.ERR_PAYMENT_VALIDATOR_PHONE) } } @@ -204,7 +202,7 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(true)) + assertTrue(first) } } @@ -224,8 +222,8 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(false)) - assertThat(second, `is`(CONST.ERR_PAYMENT_VALIDATOR_DANAL_VBANK)) + assertFalse(first) + assertEquals(second, CONST.ERR_PAYMENT_VALIDATOR_DANAL_VBANK) } } @@ -246,7 +244,7 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(true)) + assertTrue(first) } } @@ -278,7 +276,7 @@ class SdkUnitTest : AbstractKoinTest() { iamPortRequest = iamPortRequest?.copy( pg = PG.paypal.makePgRawName(), pay_method = PayMethod.card.name, - m_redirect_url = CONST.IAMPORT_PROD_URL, +// m_redirect_url = CONST.IAMPORT_PROD_URL, ) ) } @@ -286,7 +284,7 @@ class SdkUnitTest : AbstractKoinTest() { Payment.validator(payment).run { i("$second") - assertThat(first, `is`(true)) + assertTrue(first) } } }