Skip to content

Commit

Permalink
Tweaks to HTTPCALLOUTMOCKS.md
Browse files Browse the repository at this point in the history
- Add 'new' to Maps - it took me longer than I care to admit to spot that the code wasn't compiling because of `new`...
- Update example code snippets to match the method names mentioned in the docs above
  • Loading branch information
gdman committed Feb 12, 2024
1 parent f5962bf commit c9f12b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions HTTPCALLOUTMOCKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ httpCalloutMock
.respondsWith()
.status( 'Complete' )
.statusCode( 200 )
.body( Map<String,Object>{ 'parameter' => 'value' } )
.body( new Map<String,Object>{ 'parameter' => 'value' } )
.header( 'ResponseHeaderKey' ).setTo( 'value' )
```

Expand Down Expand Up @@ -100,7 +100,7 @@ httpCalloutMock
.respondsWith()
.status( 'Complete' )
.statusCode( 200 )
.body( Map<String,Object>{ 'parameter' => 'value' } )
.body( new Map<String,Object>{ 'parameter' => 'value' } )
.header( 'ResponseHeaderKey' ).setTo( 'value' );
```

Expand All @@ -125,7 +125,7 @@ httpCalloutMock
.respondsWith()
.status( 'Complete' )
.statusCode( 200 )
.body( Map<String,Object>{ 'parameter' => 'value' } )
.body( new Map<String,Object>{ 'parameter' => 'value' } )
.also().when()
.method( 'POST' )
.respondsWith()
Expand Down Expand Up @@ -209,7 +209,7 @@ Amoss_Instance httpCalloutMock = new Amoss_Instance();
httpCalloutMock
.isACalloutMock()
.when()
.header( 'Authorization' ).setTo()
.header( 'Authorization' ).set()
.respondsWith()
.status( 'Complete' )
.statusCode( 200 );
Expand All @@ -228,7 +228,7 @@ Amoss_Instance httpCalloutMock = new Amoss_Instance();
httpCalloutMock
.isACalloutMock()
.when()
.endpoint().contains( 'account/12345' )
.endpoint().containing( 'account/12345' )
.respondsWith()
.status( 'Complete' )
.statusCode( 200 );
Expand All @@ -249,7 +249,7 @@ Amoss_Instance httpCalloutMock = new Amoss_Instance();
httpCalloutMock
.isACalloutMock()
.when()
.endpoint().matches( '.*/account/12345' )
.endpoint().matching( '.*/account/12345' )
.respondsWith()
.status( 'Complete' )
.statusCode( 200 );
Expand Down

0 comments on commit c9f12b7

Please sign in to comment.