Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * @see http://salesforce.stackexchange.com/questions/27992/salesforce-unittest-exception-message-you-cannot-make-callout-after-creating-a
- */
- public class AccountUtil {
- public static void createAccount() {
- System.Savepoint savepoint = Database.setSavepoint();
- try {
- insert new Account(Name = '#deleteafter ' + DateTime.now());
- }
- catch (System.DMLException caught) {
- Database.rollback(savepoint);
- }
- }
- public static String makeCallout() {
- HttpRequest request = new HttpRequest();
- request.setEndpoint('http://www.dilbert.com');
- request.setMethod('GET');
- HttpResponse response = new Http().send(request);
- return response.getBody();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement