From 46b41ea363fb5f93decd9d2e14bfea339a3739eb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 27 Sep 2024 12:14:51 +0200 Subject: [PATCH] Konsist: implement another workaround. --- .../android/tests/konsist/KonsistClassNameTest.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt index 797f13dbe8..4257599019 100644 --- a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt +++ b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistClassNameTest.kt @@ -74,7 +74,14 @@ class KonsistClassNameTest { .replace("FakeRust", "") .replace("Fake", "") (it.name.startsWith("Fake") || it.name.startsWith("FakeRust")) && - it.parents().any { parent -> parent.name.replace(".", "") == interfaceName } + it.parents().any { parent -> + // Workaround to get the parent name. For instance: + // parent.name used to return `UserListPresenter.Factory` but is now returning `Factory`. + // So we need to retrieve the name of the parent class differently. + val packageName = parent.packagee!!.name + val parentName = parent.fullyQualifiedName!!.substringAfter("$packageName.").replace(".", "") + parentName == interfaceName + } } }