Created
September 18, 2019 23:26
-
-
Save shinchit/794f8a7ad112c4633caa14b05cda5c3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public with sharing class Some_Test { | |
@testSetup static void setup() { | |
Account acc = new Account(Name = 'account1'); | |
insert acc; | |
System.debug(acc.Id); // We can confirm Account Id on the debug log. | |
} | |
@isTest static void testMethod1() { | |
List<Account> accs = [SELECT Id FROM Account]; | |
for (Account acc : accs) { | |
System.debug(acc.Id); // We can confirm Account Id. NullPointerException is avoided!! | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment