jujiloko loko
jujiloko loko

Reputation: 51

How to build a JUnit 4 test for void methods

I have tried to use Mockito's verify in my JUnit test like this

I want to the and verify this methods

in my class of SocketEngine. How to use Mockito for verify this test? I have search how to use Mockito for void methods but I still get an error like that. and how to fix this problem.

I got error like this: the method verify(T) not applicable for void arguments

Upvotes: 1

Views: 97

Answers (1)

David Conrad
David Conrad

Reputation: 16399

You're using verify wrong. It isn't:

verify((socketEngine.read(server, readerString)));

It's:

verify(socketEngine).read(server, readerString);

Upvotes: 1

Related Questions