Last active
December 24, 2015 11:29
-
-
Save afawcett/6791111 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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