If two methods have same signature, it fails
RohitNegi opened this issue · 2 comments
RohitNegi commented
If two methods have same signature but different method name, it is failing because it try to match with method mentioned top in the hierarchy.
for example
func test_void_function() {
//given
viewModel = FroodViewModel(delegate: mockFrood)
//expect
mockFrood.expect { (f) in
f.voidFunction(value: 11)
}
//when
viewModel.checkVoidFunction(val: 11)
//then
verify()
}
func test_void_function1() {
//given
viewModel = FroodViewModel(delegate: mockFrood)
//expect
mockFrood.expect { (f) in
f.voidFunction1(value: 11)
}
//when
viewModel.checkVoidFunction(val: 11)
//then
verify()
}
mflint commented
Can you post the code for your Mock object please?
Please also give more details about how "it fails"? What is the failure, and what did you expect to happen?
RohitNegi commented
my bad, setting up of expectation was incorrect that's why it was failing. It should have been like viewModel.checkVoidFunction1(val: 11).
thanks for reply.