зеркало из
https://github.com/iharh/notes.git
synced 2025-11-02 06:36:06 +02:00
17 строки
574 B
Plaintext
17 строки
574 B
Plaintext
import org.scalatest.mockito.MockitoSugar
|
|
|
|
// First, create the mock object
|
|
val mockCollaborator = mock[Collaborator]
|
|
|
|
// Create the class under test and pass the mock to it
|
|
classUnderTest = new ClassUnderTest
|
|
classUnderTest.addListener(mock)
|
|
|
|
// Use the class under test
|
|
classUnderTest.addDocument("Document", new Array[Byte](0))
|
|
classUnderTest.addDocument("Document", new Array[Byte](0))
|
|
|
|
// Then verify the class under test used the mock object as expected
|
|
verify(mockCollaborator).documentAdded("Document")
|
|
verify(mockCollaborator, times(2)).documentChanged("Document")
|