Skip to content

Instantly share code, notes, and snippets.

@khajavi
Created April 16, 2016 12:41
Show Gist options
  • Select an option

  • Save khajavi/d229fbd293fdfe4e44243d056f35da7b to your computer and use it in GitHub Desktop.

Select an option

Save khajavi/d229fbd293fdfe4e44243d056f35da7b to your computer and use it in GitHub Desktop.
Test spy mockito
class DataRepo {
def getData = 5
}
class MockWithInjectionTest extends FunSuite {
@Spy var repo: DataRepo = _
test("spy") {
MockitoAnnotations.initMocks(this)
Mockito.when(repo.getData).thenReturn(8)
assert(repo.getData == 8)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment