Closed Xtremefaith closed 7 years ago
Once this is merged you will not need to use the generator. The Salesforce Apex Stub API takes care of this. So this will greatly simplify things for you.
The problem above is because you need to pass "a" as a List
Also i assume you are testing your mock here just to demonstrate the issue? Normally you unit test something that is dependent on the selector, such as a service class. If you check out the apex commons repo readme file you can see some blogs and samples on this.
Hope this helps! 👍
Closing now that #28 is merged.
I finally got the
4.0.1
generator to work today (first crack at setting up ApexMocks. As expected the generated populated myMocks.cls
class.Note: One thing to mention about this is I put ApexMocks into a managed package with a namespace because as a 3rd party tool I'd rather manage it like such. The generator ignores my package namespace so I have to manually add it to each property prior to deploying it
With that in place I'm attempting my first unit test with the following:
Unfortunately this test fails because of a fatal error coming from the generated mock class (
Mocks.cls
):Sidebar: Is there a way to change the style guide used by the generator, would really like to see things like open brackets in their proper place ;)
My Selector class method is setup just like the
OpportunitiesSelector.cls
example here.Is this an issue because of the managed package? Or from what I can tell it has something to do with the fact that the
fflib_ApexMocks.cls.mockNonVoidMethod()
only expects anObject
in return and can't handle aList<Object>
?Appreciate the help and the framework the more I'm understanding it all, so thank you!