Skip to content

Commit c15e877

Browse files
authored
Update README.md
1 parent a22ce35 commit c15e877

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,35 @@ Then we could do these :
9999
changeClassPropertyValueByName(demoObj, "name", newValue)
100100
assertEquals(newValue, getClassPropertyValueByName(demoObj, "name"))
101101
}
102+
103+
@org.junit.Test
104+
fun changeTopPropertyValueByName() {
105+
106+
val targetName = "fashionSeal"
107+
assertNotEquals(targetName, topName)
108+
changeTopPropertyValueByName(::topName as CallableReference, "topName", targetName)
109+
assertEquals(targetName, topName)
110+
111+
val targetAgeName = "newName"
112+
assertNotEquals(targetAgeName, getTopPropertyValueByName(::topName as CallableReference, "topAgeName"))
113+
changeTopPropertyValueByName(::topName as CallableReference, "topAgeName", targetAgeName)
114+
assertEquals(targetAgeName, getTopPropertyValueByName(::topName as CallableReference, "topAgeName"))
115+
116+
val targetAge = 18
117+
assertNotEquals(targetAge, getTopPropertyValueByName(::topName as CallableReference, "topAge"))
118+
changeTopPropertyValueByName(::topName as CallableReference, "topAge", targetAge)
119+
assertEquals(targetAge, getTopPropertyValueByName(::topName as CallableReference, "topAge"))
120+
}
121+
122+
@org.junit.Test
123+
fun invokeMethodByMethodName() {
124+
val demoObj = TestDemo()
125+
val expectedObjMethodValue = true
126+
val getMethodValue = invokeClassMethodByMethodName(demoObj, "isMan")
127+
128+
assertEquals(expectedObjMethodValue, getMethodValue)
129+
130+
}
102131

103132
```
104133

0 commit comments

Comments
 (0)