Hello everybody,

I'm currently trying to mock the HTTP client's response for unit tests.
In both cases, I have a sequence, but I need to handle them differently.

Why is that, and how can I correctly mock a response so that it behaves exactly like the real response?

Here's my test script:

# schnipp
declare function local:httpMockResponse() {
  (
    <http:response status="200"/>,
    <html>
      <foo>bar</foo>
    </html>
  )
};
<real>{http:send-request((),"https://nexoma.de")[2]/html/name()}</real>,
<mock>{local:httpMockResponse()[2]/html/name()}</mock>,

<mock2>{local:httpMockResponse()[2]/name()}</mock2> (: Why one level lower here? :)
# schnapp

I just don't get it. :(

Best regards
Andreas