I've successfully implemented Named Credentials for a Basic Auth integration callout.
However, when I went to write my test method, I noticed one minor annoyance.
When I try to create a
HttpCalloutMock class with the Named Credentials syntax,
req.setEndpoint('callout:My_Named_Credential/' + uri;);
I get an exception:
System.StringException: unknown protocol: callout
Also, as far as I can tell (based on the current documentation), there doesn't seem to be any way to programmatically access the properties of the Named Credential.
So, in order to set my
HttpCalloutMockendpoint, I now need to hardcode the URL I entered (or put it in a custom label).
Obviously, this added dependency is not idea for maintenance.
Even more frustrating... it turns out the exception is still thrown even after hardcoding the endpoint in the