-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
MinifiedClassDetectionTest.kt
52 lines (44 loc) · 1.2 KB
/
MinifiedClassDetectionTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package io.sentry.android.gradle.instrumentation.util
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.Test
class MinifiedClassDetectionTest {
@Test
fun `detects minified class names`() {
val classNames = listOf(
"l0",
"""a${'$'}a""",
"ccc017zz",
"""ccc017zz${'$'}a""",
"aa",
"aa${'$'}a",
"ab",
"aa${'$'}ab",
"ab${'$'}a"
)
classNames.forEach {
assertTrue(classNameLooksMinified(it, "com/example/$it"), it)
}
}
@Test
fun `detects minified class names with minified package name`() {
val classNames = listOf(
"""a${'$'}""",
"aa"
)
classNames.forEach {
assertTrue(classNameLooksMinified(it, "a/$it"), it)
}
}
@Test
fun `does not consider non minified classes as minified`() {
val classNames = listOf(
"ConstantPoolHelpers",
"FileUtil",
"""FileUtil${"$"}Inner"""
)
classNames.forEach {
assertFalse(classNameLooksMinified(it, "com/example/$it"), it)
}
}
}