Как проверить с Spek и Kluent - PullRequest
0 голосов
/ 10 мая 2018

У меня простой интерфейс, но когда я пытаюсь его высказать, мой тест не пройден.Это ошибка.

Mockito cannot mock this class: interface pmb.net.conn.types.INetworkLayer.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the 
mailing list.


Java               : 1.8
JVM vendor name    : Oracle Corporation
JVM vendor version : 25.0-b70
JVM name           : Java HotSpot(TM) 64-Bit Server VM
JVM version        : 1.8.0-b132
JVM info           : mixed mode
OS name            : Windows 8.1
OS version         : 6.3


Underlying exception : java.lang.IllegalArgumentException: object is not an 
instance of declaring class
org.mockito.exceptions.base.MockitoException: 
Mockito cannot mock this class: interface pmb.net.conn.types.INetworkLayer.

Это интерфейс.

interface INetworkLayer {
    fun getDbStateHash(peerInfo: IPeerInfo): String
    fun getBlockMap(peerInfo: IPeerInfo, blockNumber: Int): IBlockMap
    fun getBlockPackages(blockNumber: Int, 
               packageIdsList: Iterable<String>): Iterable<BlockChunk>
}

Это часть моего тестового кода

describe("Description") {
    val peerInfoMock = mock(IPeerInfo::class)
    val networkLayerMock = mock(INetworkLayer::class)
    val peer = Peer(peerInfoMock, networkLayerMock)
...