10000 Reproducer · mockk/mockk@0eefb0f · GitHub
[go: up one dir, main page]

Skip to content

Commit 0eefb0f

Browse files
committed
Reproducer
1 parent fa404b5 commit 0eefb0f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.mockk.core;
2+
3+
4+
interface AnInterface {
5+
int foo();
6+
}
7+
8+
interface InterfaceWithDefaultImpl extends AnInterface {
9+
@Override
10+
default int foo() {
11+
return 10;
12+
}
13+
}
14+
15+
public class ClassImplementingInterfaceWithDefaultMethod implements InterfaceWithDefaultImpl {
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.mockk.impl
2+
3+
import io.mockk.core.ClassImplementingInterfaceWithDefaultMethod
4+
import io.mockk.every
5+
import io.mockk.mockk
6+
import org.junit.jupiter.api.Assertions.assertEquals
7+
import org.junit.jupiter.api.Test
8+
9+
10+
class DefaultMethodTest {
11+
@Test
12+
fun `should mock ClassImplementingInterfaceWithDefaultMethod class`() {
13+
val tableImpl = mockk<ClassImplementingInterfaceWithDefaultMethod>()
14+
every { tableImpl.foo() } returns 12
15+
assertEquals(12, tableImpl.toString())
16+
}
17+
}

0 commit comments

Comments
 (0)
0