java - JMockit throwing errors -
i'm trying mock interface class using jmockit, following example in documentation. however, im getting error saying
java.lang.illegalargumentexception: matching real methods not found following mocks: package.jmockittest$1#httpresponse(package.httpclient client)
@test public void mockinganinterface() throws exception { httpclient client = new mockup<httpclient>() { @mock string httpresponse(httpclient client) { return "100"; } }.getmockinstance(); weblogic weblogic = new weblogic(); assert.assertequals(client.httpresponse("asd"), "100"); }
you passing string @ line client.httpresponse("asd"), "100" while mocked method expects httpclient need mock method,
@mock string httpresponse(string client) { return "100"; } in mockup or
you need change call use httpclient instead of string
Comments
Post a Comment