New answers tagged

0 votes
Accepted

Test class for covering running user current application info

First principles: UserAppInfo is not considered as metadata available to a testmethod. It is an SObject that must be mocked (like Account or Opportunity) Now, you might think you could mock ...
user avatar
  • 62.2k
1 vote
Accepted

How to write Apex unit test for a function that fetches meta data?

I'm assuming you are wanting to deploy this as a managed package, and hence why you do not know if the target organization would have any custom objects? If so, then I would make the suggestion of ...
user avatar
  • 740
1 vote
Accepted

How to get Test Coverage on a Simple Wrapper Class

You are missing testing the actual code that does work -- public static WebhookWrapper parse(String json) { return (WebhookWrapper) System.JSON.deserialize(json, WebhookWrapper.class); } You need ...
user avatar
  • 62.2k
0 votes

How to set a Date in apex test class?

Another option is using system.today().addDays(10) acc.effectiveDate__c = System.today().addDays(10);
user avatar
1 vote

Test Method Issue for removing duplicates from List

The signature of the method is to accept List<Sobjects>, But you are passing the list <String>. Can you try passing List<Sobject> to the method.
user avatar
0 votes

Visual representation code coverage in VSCode

You can get the code coverage as in Developer Console (code coverage for each test method) with this extension. Disable retrieve-test-code-coverage from settings if you use it. https://marketplace....
user avatar

Top 50 recent answers are included