Skip to content

Instantly share code, notes, and snippets.

@dhoechst
dhoechst / 0-ApexTestingBestPractices.md
Last active April 28, 2022 03:30
Testing Best Practices and Examples

This Gist shows code examples for Apex Testing Best Practices. It relys on having the TestFactory in your org.

@dhoechst
dhoechst / OpportunityNewDispatcher
Last active August 29, 2015 14:01
Creating a Dispatcher
<apex:page standardController="Opportunity"
extensions="OpportunityNewDispatcherController"
action="{!redirect}">
</apex:page>
@dhoechst
dhoechst / 1 - Singleton
Last active December 23, 2015 12:39
Trying to understand the singleton pattern and why some people consider it bad.
// from http://wiki.developerforce.com/page/Apex_Design_Patterns_-_Singleton
// What makes this a singleton pattern? Is it that it uses a private constructor?
public class AccountFooRecordType {
// private static variable referencing the class
private static AccountFooRecordType instance = null;
public String id {get;private set;} // the id of the record type
// The constructor is private and initializes the id of the record type
private AccountFooRecordType(){