Created
October 2, 2019 09:33
-
-
Save olopsman/f263440caf19a8835c3ff09849bb6369 to your computer and use it in GitHub Desktop.
Apex MyServiceAPITest Unit Test using GenericRESTMock
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
@isTest | |
private class MyServiceAPITest { | |
@isTest static void getTransactionsTest() { | |
Test.startTest(); | |
Map<String,String> headers = new Map<String, String>(); | |
headers.put('Accept','application/json'); | |
Test.setMock(HttpCalloutMock.class, new GenericRESTMock(200,'Success','{"Items":[{"Id":"string","Code":"string","EffectiveDate":"2019-07-15T22:03:31.145Z","Type":"APP"]}',headers)); | |
String str = MyServiceAPI.getTransactions('7/15/2019'); | |
Test.stopTest(); | |
system.assertEquals(null, str); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment