Hello Venkat,
I have sent you a note on this. I am also posting the information here below.
You can implement multiple virtual services in a single junit test case (using different rr pair) based on either the match clause or an if clause. Example is shown below.
In below case, we have two Post virtual services, each with different match criteria (in this case, match request based on the request file). It can also be match based on a certain request parameter (using either matchesBodyPayload or matchesQuery or matchesHeader or a combination)
.
@Test
public void exampleTest() {
forPost(Application.URL)
.matchesHeader("X-Custom-Header","TEST")
.matchesBodyFromFile("Request.txt")
.doReturn(
okMessage().withBodyFile("Response.txt")
);
forPost(Application.URL)
.matchesHeader("X-Custom-Header","TEST")
.matchesBodyFromFile("Request1.txt")
.doReturn(
okMessage().withBodyFile("Response1.txt")
);
}