From aa4989c7a06df6ddfac9ce3dbaed74c1888ecd3d Mon Sep 17 00:00:00 2001 From: Ryan Bergman Date: Wed, 31 Jan 2024 11:04:26 -0600 Subject: [PATCH] issue #513 example test on different methods --- .../src/test/java/kong/tests/AssertTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/unirest-mocks/src/test/java/kong/tests/AssertTest.java b/unirest-mocks/src/test/java/kong/tests/AssertTest.java index 780740cb..d4f0f431 100644 --- a/unirest-mocks/src/test/java/kong/tests/AssertTest.java +++ b/unirest-mocks/src/test/java/kong/tests/AssertTest.java @@ -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 body; @Override