Skip to content

Commit

Permalink
issue #513 example test on different methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ryber committed Jan 31, 2024
1 parent a1ea70d commit aa4989c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions unirest-mocks/src/test/java/kong/tests/AssertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,19 @@ void verbsAreImportant() {
assertNotEquals("hi", Unirest.post(path).asString().getBody());
}

@Test
public void samePathDifferentMethodTest() {
client.expect(HttpMethod.GET, path);
client.expect(HttpMethod.POST, path);

Unirest.get(path).asJson();
client.assertThat(HttpMethod.GET, path).wasInvokedTimes(1);

Unirest.post(path).asJson();
client.assertThat(HttpMethod.GET, path).wasInvokedTimes(1);
client.assertThat(HttpMethod.POST, path).wasInvokedTimes(1);
}

private static class BodyBuddy implements Supplier<String>{
String body;
@Override
Expand Down

0 comments on commit aa4989c

Please sign in to comment.