Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 17582

A unit test is code that is written and executed to test a specific portion/unit of source code. Unit tests are class methods with the testMethod modifier or @isTest annotation and are usually placed in separate test classes annotated with the @isTest annotation. Code that is executed by unit tests is considered covered. At least 75% of an organization's codebase must be covered by unit tests and every trigger must have at least 1% unit test coverage.

1 vote
2 answers
2k views

How to Specify System.now() in Json while creating a record

I'm creating a record in a test class that needs a specific LastModifiedDate, that date would be, today's date minus 365 days. When I create the record, this is what the code looks like: String OppJS …
Leo's user avatar
  • 329
5 votes
2 answers
6k views

How to create test objects with lastModifiedDate in past

So I created a Job that is supposed to run every day and give me a list of Opportunity records that have not been modified in the last 6 months, so I can email the owner and let him/her know that the …
Leo's user avatar
  • 329
0 votes
2 answers
195 views

Code Coverage not reaching 100%

I created a trigger and 2 test classes. They only cover 73% and I can't figure out why. The trigger updates the field "Email_Opt_In__c" on the Lead/Contact that is a campaignMember with a "Registered" …
Leo's user avatar
  • 329
1 vote
1 answer
93 views

System Assertion not returning the right result in an @Future method

I have a class that updates leads and sends emails to the Lead owners, this part works just fine. Now that I'm writing the Test class, in my test the lead I create doesn't get updated. Why could that …
Leo's user avatar
  • 329
3 votes
2 answers
830 views

How to use Dependency Injection while testing

I've been trying to create a job that while working on my test class I should be able to pass 2 lists and the job work work on those lists but once I deploy my code, it should work using my real data. …
Leo's user avatar
  • 329