Skip to content

Commit

Permalink
refactor(test): assertConstantUniqueness
Browse files Browse the repository at this point in the history
this allows handling Companion objects as well
  • Loading branch information
BrayanDSO committed Dec 13, 2024
1 parent fcbba5b commit a97e874
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.junit.Test
import kotlin.reflect.KClass
import kotlin.reflect.KVisibility
import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.jvm.javaField
import kotlin.test.assertFalse
import kotlin.test.assertNotNull

Expand All @@ -44,7 +45,7 @@ class ConstantUniquenessTest {
continue
}
// use .call() since clazz represents an object
val value = prop.call()
val value = prop.javaField?.get(null)
assertFalse(valueSet.contains(value), "Duplicate value ('$value') for constant in ${clazz.qualifiedName}")
valueSet.add(value)
}
Expand Down

0 comments on commit a97e874

Please sign in to comment.