New answers tagged unit-test
0
votes
Test Class for Approval Process - Problem with ProcessInstanceWorkItem
In your test method you just instantiated req1, but it seems you didn't processed/saved it.
You could try:
Approval.ProcessResult result = Approval.process( req1 );
I believe this would create a ...
0
votes
Maximum stack depth has been reached when testing
Well, the responses have been flooding in.
In the meantime, I refactored and removed the SuppressionQueue class that was in the end was unnecessary. Since the classes doing the DML were Queueable ...
0
votes
Unit test - handleMethodCall - how to specify the return type?
Ok, I've solved by the problem by adding
if (returnType.getName() == 'String') {
return 'test';
} else {
return null;
}
But in the same time I still don't understand how ...
0
votes
Accepted
Getting error: This class name's value is invalid: MyNamespace.CampaignControllerTest. Provide the name of an Apex class that has test methods
I wanted to post this as I think it is now working. It was really quite painful to get to the answer.
Based on my original setup I had to do two things.
Firstly, I had to add meta files. I had my ...
0
votes
Accepted
ApexMocks throwing System.TypeException: Class IEmailService__sfdc_ApexStub must implement the method
The reason is the Exception e as the method parameter. This is not a fflib-apex-mocks limitation, it's generic to Salesforce. I still would love to know why though.
The workaround I thought of is to ...
2
votes
Accepted
Uncommitted work pending issue in Test using - System.runAs()
Test.startTest() documentation states
Any code that executes after the call to startTest and before stopTest is assigned a new set of governor limits.
You currently have a dml, TestDataFactory....
1
vote
Accepted
Apex test using ConnectApi stub mock consistently fails with no matching item error
I submitted a case with Salesforce and they said ConnectApi.ContentHub.setTestAddRepositoryItem needs to be called with the same ConnectApi.BinaryInput object reference as ConnectApi.ContentHub....
0
votes
Accepted
How to generate apex tests (for old apex classes) with TestDataFactory included
It turned out, it is easy enough asking AgentForce to use our own test data factory in prompts. What's more we can even ask to generate new test data factory method in the factory class for objects ...
Top 50 recent answers are included
Related Tags
unit-test × 4775apex × 2988
code-coverage × 827
trigger × 567
failing-tests × 322
class × 208
batch × 203
visualforce × 186
callout × 126
test-setup × 121
soql × 120
deployment × 116
controller × 110
httpcalloutmock × 110
scheduled-apex × 92
community × 56
exception × 56
lightning-web-components × 54
rest-api × 48
webservices × 48
controller-extension × 47
future × 46
error × 44
managed-package × 42
salesforcedx × 41