{"action":"created","issue":{"url":"https://api.github.com/repos/financialforcedev/fflib-apex-common/issues/90","labels_url":"https://api.github.com/repos/financialforcedev/fflib-apex-common/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/financialforcedev/fflib-apex-common/issues/90/comments","events_url":"https://api.github.com/repos/financialforcedev/fflib-apex-common/issues/90/events","html_url":"https://github.com/financialforcedev/fflib-apex-common/issues/90","id":113794189,"number":90,"title":"System.CalloutException: You have already created Savepoints. You cannot make callout after creating a Savepoint","user":{"login":"thegogz","id":283730,"avatar_url":"https://avatars.githubusercontent.com/u/283730?v=3","gravatar_id":"","url":"https://api.github.com/users/thegogz","html_url":"https://github.com/thegogz","followers_url":"https://api.github.com/users/thegogz/followers","following_url":"https://api.github.com/users/thegogz/following{/other_user}","gists_url":"https://api.github.com/users/thegogz/gists{/gist_id}","starred_url":"https://api.github.com/users/thegogz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegogz/subscriptions","organizations_url":"https://api.github.com/users/thegogz/orgs","repos_url":"https://api.github.com/users/thegogz/repos","events_url":"https://api.github.com/users/thegogz/events{/privacy}","received_events_url":"https://api.github.com/users/thegogz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-28T11:06:00Z","updated_at":"2015-10-28T12:32:26Z","closed_at":null,"body":"I'm currently working on implementing this library for our organization and am struggling with an issue in unit tests\r\n\r\n```\r\nSystem.CalloutException: You have already created Savepoints.   You cannot make callout after creating a Savepoint\r\n```\r\n\r\nWhat I did was extend the ```fflib_SobjectUnitOfWork``` class using a custom class with an additional \"Work\" item inner-class SendSMSWork which calls my SMS integration class. This follows the same pattern as the registerEmail pattern already in the parent class. When I originally tried this in the UI all works absolutely fine and my SMS is sent. However in my Unit tests I'm having issues with the above error. \r\n\r\nI'm wondering if anyone else has solved this issue and what would be the advised way within the context of this library?\r\n\r\nI'm hoping I can mock out my SMS Service which would allow these tests to pass. "},"comment":{"url":"https://api.github.com/repos/financialforcedev/fflib-apex-common/issues/comments/151829340","html_url":"https://github.com/financialforcedev/fflib-apex-common/issues/90#issuecomment-151829340","issue_url":"https://api.github.com/repos/financialforcedev/fflib-apex-common/issues/90","id":151829340,"user":{"login":"thegogz","id":283730,"avatar_url":"https://avatars.githubusercontent.com/u/283730?v=3","gravatar_id":"","url":"https://api.github.com/users/thegogz","html_url":"https://github.com/thegogz","followers_url":"https://api.github.com/users/thegogz/followers","following_url":"https://api.github.com/users/thegogz/following{/other_user}","gists_url":"https://api.github.com/users/thegogz/gists{/gist_id}","starred_url":"https://api.github.com/users/thegogz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegogz/subscriptions","organizations_url":"https://api.github.com/users/thegogz/orgs","repos_url":"https://api.github.com/users/thegogz/repos","events_url":"https://api.github.com/users/thegogz/events{/privacy}","received_events_url":"https://api.github.com/users/thegogz/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T12:32:26Z","updated_at":"2015-10-28T12:32:26Z","body":"Thanks @tfuda that has helped work around the issue. The call is indeed in an *@future* For now I can just watch where I use the Test.stopTest() and Test.startTest() in my tests. "}}