mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
CORDA-3188: Ignore synthetic and static fields when searching for state pointers (#5439)
This commit is contained in:
@ -5,6 +5,7 @@ import net.corda.core.crypto.NullKeys
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.AnonymousParty
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@ -32,6 +33,15 @@ class StatePointerSearchTests {
|
||||
override val participants: List<AbstractParty> get() = listOf()
|
||||
}
|
||||
|
||||
private data class StateWithStaticField(val blah: Int) : ContractState {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val pointer = LinearPointer(UniqueIdentifier(), LinearState::class.java)
|
||||
}
|
||||
|
||||
override val participants: List<AbstractParty> get() = listOf()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `find pointer in state with generic type`() {
|
||||
val linearPointer = LinearPointer(UniqueIdentifier(), LinearState::class.java)
|
||||
@ -74,4 +84,9 @@ class StatePointerSearchTests {
|
||||
assertEquals(results, setOf(linearPointer))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ignore static fields`() {
|
||||
val results = StatePointerSearch(StateWithStaticField(1)).search()
|
||||
assertThat(results).isEmpty()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user