Skip to content

Commit ba309e6

Browse files
1.0.0-rc4
1 parent 6baf699 commit ba309e6

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

onixlabs-corda-identity-framework-contract/src/main/kotlin/io/onixlabs/corda/identityframework/contract/Extensions.kt

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

1919
import kotlin.reflect.KVisibility
2020
import kotlin.reflect.full.declaredMemberProperties
21+
import kotlin.reflect.full.memberProperties
2122

2223
/**
2324
* Checks a collection of [AbstractClaim] instances for duplicate keys.
@@ -37,7 +38,7 @@ fun Iterable<AbstractClaim<*>>.checkForDuplicateKeys(
3738
* @return Returns a string representation of the current object, like a Kotlin data class.
3839
*/
3940
internal fun Any.toDataClassString(): String {
40-
val properties = javaClass.kotlin.declaredMemberProperties
41+
val properties = javaClass.kotlin.memberProperties
4142
.filter { it.visibility == KVisibility.PUBLIC }
4243
.joinToString(", ") { "${it.name} = ${it.get(this).toString()}" }
4344

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ class DataClassStringTests {
3131

3232
assertEquals(expected, actual)
3333
}
34+
35+
@Test
36+
fun `toDataClassString called on GreetingClaim should produce the expected result`() {
37+
val claim = GreetingClaim("John")
38+
39+
val expected = "GreetingClaim(greeter = John, property = Greeting, value = Hello, World!)"
40+
val actual = claim.toString()
41+
42+
assertEquals(expected, actual)
43+
}
3444
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.onixlabs.corda.identityframework.contract.general
2+
3+
import io.onixlabs.corda.identityframework.contract.Claim
4+
5+
class GreetingClaim(val greeter: String) : Claim<String>("Greeting", "Hello, World!")

0 commit comments

Comments
 (0)