Skip to content

Commit 4a9a831

Browse files
committed
Add scaladoc for scalatest integrations
1 parent b489c0c commit 4a9a831

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The trait has to be mixed **after** `org.mockito.MockitoSugar` in order to work,
154154
The code shown in the StackOverflow question would look like this if using this mechanism
155155

156156
```scala
157-
TestClass extends PlaySpec with MockitoSugar with ResetMocksAfterEachTest
157+
class MyTest extends PlaySpec with MockitoSugar with ResetMocksAfterEachTest
158158

159159
private val foo = mock[Foo]
160160

core/src/main/scala/org/mockito/integrations/scalatest/IdiomaticMockitoFixture.scala

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
package org.mockito.integrations.scalatest
22

33
import org.mockito._
4-
import org.scalatest.{Outcome, Suite, TestSuite}
4+
import org.scalatest.{ Outcome, Suite, TestSuite }
55

6+
/**
7+
* It automatically wraps each test in a MockitoScalaSession so the implicit verifications are applied
8+
*
9+
* Just mix-in after your favourite suite, i.e. {{{class MyTest extends WordSpec with IdiomaticMockitoFixture}}}
10+
*
11+
*/
612
trait IdiomaticMockitoFixture extends TestSuite with IdiomaticMockito with ArgumentMatchersSugar { this: Suite =>
713

814
abstract override def withFixture(test: NoArgTest): Outcome =

core/src/main/scala/org/mockito/integrations/scalatest/MockitoFixture.scala

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ package org.mockito.integrations.scalatest
33
import org.mockito._
44
import org.scalatest.{ Outcome, Suite, TestSuite }
55

6+
/**
7+
* It automatically wraps each test in a MockitoScalaSession so the implicit verifications are applied
8+
*
9+
* Just mix-in after your favourite suite, i.e. {{{class MyTest extends WordSpec with MockitoFixture}}}
10+
*
11+
*/
612
trait MockitoFixture extends TestSuite with MockitoSugar with ArgumentMatchersSugar { this: Suite =>
713

814
abstract override def withFixture(test: NoArgTest): Outcome =

core/src/main/scala/org/mockito/integrations/scalatest/ResetMocksAfterEachTest.scala

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ import scala.collection.JavaConverters._
1010
import scala.reflect.ClassTag
1111
import scala.reflect.runtime.universe.TypeTag
1212

13+
/**
14+
* It automatically resets each mock after a each test is run, useful when we need to pass the mocks to some framework
15+
* once at the beginning of the test suite
16+
*
17+
* Just mix-in after your favourite suite, i.e. {{{class MyTest extends PlaySpec with MockitoSugar with ResetMocksAfterEachTest}}}
18+
*
19+
*/
1320
trait ResetMocksAfterEachTest extends TestSuite with MockCreator { self: MockCreator =>
1421

1522
private val mocksToReset = ConcurrentHashMap.newKeySet[AnyRef]().asScala

0 commit comments

Comments
 (0)