Skip to content

Instantly share code, notes, and snippets.

@shinchit
Created September 18, 2019 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinchit/47e50cbcd1c1c24bffc22d00c5356091 to your computer and use it in GitHub Desktop.
Save shinchit/47e50cbcd1c1c24bffc22d00c5356091 to your computer and use it in GitHub Desktop.
@isTest
public with sharing class Some_Test {
private Account acc {get; set;}
@testSetup static void setup() {
acc = new Account(Name = 'account1');
insert acc;
System.debug(acc.Id); // We can confirm Account Id on the debug log.
}
@isTest static void testMethod1() {
System.debug(acc.Id); // We'll get an error. NullPointerException occur!!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment