Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
2  Chess.iml
View
@@ -14,6 +14,8 @@
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.9.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.0" level="project" />
</component>
</module>
7 pom.xml
View
@@ -21,6 +21,13 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
10 src/test/java/com/leokom/chess/gui/winboard/WinBoardPlayerTest.java
View
@@ -4,6 +4,8 @@
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.*;
+
/**
* Author: Leonid
@@ -17,11 +19,13 @@
@Test
public void creationSwitchesToInitMode() {
- MockCommander commander = new MockCommander();
+ WinboardCommander commander = mock( WinboardCommander.class );
- WinboardPlayer controller = new WinboardPlayer( commander );
+ //implicit call of startInit
+ new WinboardPlayer( commander );
- assertEquals( 1, commander.getStartInitCallsCount() );
+ //it really checks only 1 method call
+ verify( commander ).startInit();
}
//ensure need of refactoring into commander instead of communicator

No commit comments for this range

Something went wrong with that request. Please try again.