JMockit method that isn't mocked doesn't work -
sample class
public class test{ @tested classa obja; @test(expected = myexception.class){ string expectedvar = "expectedvar"; new expectations(obja) { { obja.somemethod(); result = expectedvar; } }; // here error, when debug programm doesn't enter following method. // if connent out new expectations(){{...}} block, programm // enter method obja.execute() obja.execute(); }
could explain happening here , why setting expectations on method changes behaviour of other method?
i didn't find answer, did other way:
new mockup<classa>() { @mock string somemethod() { return expectedvar; } };
and worked expected
Comments
Post a Comment