I need to verify a call for handler.sendMessage(msg)
.
Code:
//This bundleImportStorage will send message to UI handler by passing message object
bundleImporter.bundleImportFromStorage(intent);
//In this line I am getting error
when(uiHandler.sendMessage(any(Message.class))).thenReturn(true);
Exception details:
org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
2 matchers expected, 1 recorded:
-> at com.fio.installmanager.nonui.com.bundleimport.TestBundleImport.testIntentExtras(TestBundleImport.java:69)
This exception may occur if matchers are combined with raw values:
//incorrect:
someMethod(anyObject(), "raw String");
When using matchers, all arguments have to be provided by matchers.
For example:
//correct:
someMethod(anyObject(), eq("String by matcher"));