junit - Java constructor mockup -
could please 1 tell me how mock java constructor ? tried below. doesn't work.
new mockup<usercompanydivision>() { @mock public usercompanydivision(string com, string div) { } };
since constructors don't have names methods do, jmockit uses special name "$init" corresponding @mock
methods. example:
new mockup<usercompanydivision>() { @mock // matches constructor having same parameters void $init(string com, string div) { // ... } };
note described in api documentation @mock
.
Comments
Post a Comment