jackmiras
04/25/2017, 6:46 PMgiven("a call to the function save") {
it("should call the prePersist function") {
val user = factory.buildMock()
val dataStore = mock<Datastore>()
whenever(dataStore.save(user)).doReturn(Key(User::class.java, "User", user.id))
userRepository.save(user)
verify(user, atLeastOnce()).prePersist()
}
}
But when the whenever() function is called I'm getting a exception because de `dataStore`object is a mock and he is not creating or holding the information about the collections on my MongoDB.
Does anyone know a way to make the test run in order to make possible to write the code for this unit test?