Skip to content

Instantly share code, notes, and snippets.

jessealtman / MyController
Created June 27, 2014 19:12
Real Unit Tests using ApexMocks
public class MyController{
private MyInterface myImplementation;
public Integer valueOne{get;set;}
public Integer valueTwo{get;set;}
public MyController(MyInterface myImplementation){
this.myImplementation = myImplementation;
public Integer calculatedTotalValue(){
jessealtman /
Created June 27, 2014 19:06
ApexMocks: Setup
# Specify the login credentials for the desired Salesforce organization
sf.username = <insert username here>
sf.password = <insert password and security token>
# Use '' for production or developer edition
# Use ' for sandbox.
sf.serverurl =
sf.maxPoll = 20
jessealtman / ExampleController
Created April 19, 2014 14:18
Proper Unit Test Structure in Apex
public class ExampleController
public Integer differenceInFooWidgetsAndStubCount(Id fooId, Id stubId){
Foo__c foo = [
(SELECT Id FROM Widget__r)
jessealtman / StackExchangeService
Created April 19, 2014 14:11
StackExchange API on Salesforce!
public class StackExchangeService{
public List<SFSEQuestion> getStackExchangeQuestionsDeserialize(){
Http httpQuestions = new Http();
HttpRequest requestQuestions = new HttpRequest();
requestQuestions.setHeader('Content-Type', 'application/json');
HTTPResponse responseQuestions = httpQuestions.send(requestQuestions);
List<SFSEQuestion> questions = new List<SFSEQuestion>();
jessealtman / PaymentInterface
Created April 19, 2014 14:04
Dependency Injection in Apex
public interface PaymentInterface{
String processPayment();
jessealtman / ChatterGalleryPage
Last active August 29, 2015 13:59
Chatter Gallery
<apex:page showHeader="true" sidebar="true" title="Chatter Gallery" controller="ChatterGalleryPageController">
<apex:includeScript value="//"/>
<apex:includeScript value="//"/>
<apex:stylesheet value="//"/>
<apex:includeScript value="{!URLFOR($Resource.Galleria,'galleria/galleria-1.3.5.min.js')}"/>
.galleria{ width: 700px; height: 400px; background: #000 }
<apex:sectionHeader title="View Chatter Images" subtitle="Chatter Gallery" />