Skip to content

Commit 04a2b9f

Browse files
1.0.0
1 parent 1ede40a commit 04a2b9f

File tree

1 file changed

+14
-5
lines changed
  • onixlabs-corda-identity-framework-contract/src/test/kotlin/io/onixlabs/corda/identityframework/contract

1 file changed

+14
-5
lines changed

onixlabs-corda-identity-framework-contract/src/test/kotlin/io/onixlabs/corda/identityframework/contract/MockData.kt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package io.onixlabs.corda.identityframework.contract
1818

1919
import net.corda.core.contracts.BelongsToContract
2020
import net.corda.core.contracts.StateRef
21+
import net.corda.core.contracts.UniqueIdentifier
2122
import net.corda.core.crypto.SecureHash
2223
import net.corda.core.identity.AbstractParty
2324
import net.corda.core.identity.CordaX500Name
@@ -35,9 +36,17 @@ val CLAIM_2 = CordaClaim(IDENTITY_B.party, IDENTITY_B.party, "example", 123)
3536
val EMPTY_REF = StateRef(SecureHash.zeroHash, 0)
3637

3738
@BelongsToContract(CordaClaimContract::class)
38-
data class CustomCordaClaim(override val participants: List<AbstractParty> = emptyList()) :
39-
CordaClaim<String>(IDENTITY_A.party, IDENTITY_B.party, "example", "Hello, World!") {
40-
fun withIssuerAndHolder() = copy(participants = listOf(issuer, holder))
41-
fun withoutIssuer() = copy(participants = listOf(holder))
42-
fun withoutHolder() = copy(participants = listOf(issuer))
39+
class CustomCordaClaim(
40+
value: String = "Hello, World!",
41+
previousStateRef: StateRef? = null,
42+
override val participants: List<AbstractParty> = emptyList()
43+
) : CordaClaim<String>(IDENTITY_A.party, IDENTITY_B.party, "example", value, UniqueIdentifier(), previousStateRef) {
44+
45+
override fun amend(previousStateRef: StateRef, value: String): CordaClaim<String> {
46+
return CustomCordaClaim(value, previousStateRef)
47+
}
48+
49+
fun withIssuerAndHolder() = CustomCordaClaim(participants = listOf(issuer, holder))
50+
fun withoutIssuer() = CustomCordaClaim(participants = listOf(holder))
51+
fun withoutHolder() = CustomCordaClaim(participants = listOf(issuer))
4352
}

0 commit comments

Comments
 (0)