Take interfaces out into their own files #226
dafyddjohns
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
From what I can see, this isn't as easy as moving those interfaces out. Each of those interfaces then becomes a dependency if you are mocking the outermost Queryable class. I would need to mock a bunch of the other interfaces that feed into the query in order to spy on them, but there might be a simpler way. Essentially I want to be able to use Mockery's "this method was called with this argument", to ensure the logic is baked into the queries. Any guidance/recommendations/thoughts appreciated. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
The interfaces as they currently stand, within the SOQL class, do not allow then to be utilised with frameworks such as Apex Mockery, that depends on Test.createStub(). Mocking an inner type such as Queryable throws a System.TypeException with message "Test.createStub() cannot be called with inner Apex classes".
I can see that there is a mechanism to mock, but I'd like to be aligned with the apex mockery framework.
Context:
Apex Mockery is being used to create mocks of dependencies, but one of my dependencies uses SOQL lib. My real implementation has no coverage, which is expected as I haven't done integration tests, but I do want to verify that certain methods within my dependency are performing queries that contain certain logic.
Moving the interfaces out would allow better compatibility with such frameworks.
Beta Was this translation helpful? Give feedback.
All reactions