Permalink
Browse files

Started using Mockito verification. However I don't see guarantees th…

…at it checks exactly 1 method call
  • Loading branch information...
1 parent 6929aa7 commit c9c1bbc65612afed063daae76ee43ddbeefeb013 @lrozenblyum committed Dec 2, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/test/java/com/leokom/chess/gui/winboard/WinBoardPlayerTest.java
View
9 src/test/java/com/leokom/chess/gui/winboard/WinBoardPlayerTest.java
@@ -4,6 +4,8 @@
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.*;
+
/**
* Author: Leonid
@@ -17,11 +19,14 @@
@Test
public void creationSwitchesToInitMode() {
+ WinboardCommander commander1 = mock( WinboardCommander.class );
+
+
MockCommander commander = new MockCommander();
- WinboardPlayer controller = new WinboardPlayer( commander );
+ WinboardPlayer controller = new WinboardPlayer( commander1 );
- assertEquals( 1, commander.getStartInitCallsCount() );
+ verify( commander1 ).startInit();
}
//ensure need of refactoring into commander instead of communicator

0 comments on commit c9c1bbc

Please sign in to comment.