fit for kotlin auto generated accessor method

This commit is contained in:
金戟
2021-01-05 23:28:35 +08:00
parent 55ec1ca5b5
commit 0a1b46b352
6 changed files with 43 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ class DemoMockTest {
}
@MockMethod
private String staticFunc(DemoMock self) {
private String staticFunc(DemoMock ignore) {
return "_MOCK_TAIL";
}
@@ -77,6 +77,7 @@ class DemoMockTest {
void should_able_to_mock_member_method() throws Exception {
assertEquals("{ \"res\": \"mock_hello_MOCK_TAIL\"}", demoMock.outerFunc("hello"));
verify("innerFunc").with("hello");
verify("staticFunc").with();
}
@Test

View File

@@ -61,5 +61,9 @@ class DemoMock {
private fun staticFunc(): String {
return "_STATIC_TAIL"
}
// fun callStaticFunc(): String {
// return "CALL${staticFunc()}"
// }
}
}

View File

@@ -26,7 +26,7 @@ internal class DemoMockTest {
private fun innerFunc(self: DemoMock, text: String) = "mock_$text"
@MockMethod
private fun staticFunc(self: DemoMock): String {
private fun staticFunc(ignore: DemoMock): String {
return "_MOCK_TAIL";
}
@@ -72,8 +72,15 @@ internal class DemoMockTest {
fun should_able_to_mock_member_method() {
assertEquals("{ \"res\": \"mock_hello_MOCK_TAIL\"}", demoMock.outerFunc("hello"))
verify("innerFunc").with("hello")
verify("staticFunc").with()
}
// @Test
// fun should_able_to_mock_method_in_companion_object() {
// assertEquals("CALL_MOCK_TAIL", DemoMock.callStaticFunc())
// verify("staticFunc").with()
// }
@Test
fun should_able_to_mock_common_method() {
assertEquals("trim_string__sub_string__false", demoMock.commonFunc())