-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathApex Integration Services- Apex SOAP Callouts
43 lines (33 loc) · 1.43 KB
/
Apex Integration Services- Apex SOAP Callouts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
##ParkLocator.apxc
public class ParkLocator {
public static String[] country(String country){
ParkService.ParksImplPort Locator = new ParkService.ParksImplPort();
return Locator.byCountry(country);
}
}
##ParkLocatorTest.apxc
@isTest
public class ParkLocatorTest {
@isTest static void testMock(){
test.setMock(WebserviceMock.class, new ParkServiceMock());
String[] parksName = ParkLocator.Country('India');
List<String> country = new List<String>();
country.add('Inamdar National Park');
country.add('Riza National Park');
country.add('Shilpa National Park');
System.assertEquals(country, parksName, 'park names are not as expected');
}
}
##ParkServiceMock
global class ParkServiceMock implements WebServiceMock {
global void doInvoke(Object stub,Object request,Map<String, Object> response,String endpoint,
String soapAction,String requestName,String responseNS,String responseName,String responseType){
ParkService.byCountryResponse response_x = new ParkService.byCountryResponse();
List<String> country = new List<String>();
country.add('Inamdar Shola National Park');
country.add('Riza National Park');
country.add('Shilpa National Park');
response_x.return_x = country;
response.put('response_x', response_x);
}
}