Skip to content

Instantly share code, notes, and snippets.

@afawcett
Last active December 24, 2015 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afawcett/6791111 to your computer and use it in GitHub Desktop.
Save afawcett/6791111 to your computer and use it in GitHub Desktop.
public with sharing class AssertCallback {
private static Map<Type, IAssertCallback> callbacks = new Map<Type, IAssertCallback>();
public interface IAssertCallback
{
void assert(String location, Object state);
}
public static void assert(Type stateType, String location, Object state)
{
if(!Test.isRunningTest())
return;
if(callbacks.containsKey(stateType))
callbacks.get(stateType).assert(location, state);
}
public static void registerCallback(Type stateClass, IAssertCallback assertCallback)
{
callbacks.put(stateClass, assertCallback);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment