RESTMockServer { public static MatchableCall whenRequested(Matcher<RecordedRequest> requestMatcher) { return new MatchableCall(RESTMockServer.RESTMockFileParser, requestMatcher, dispatcher); } private  RESTMockServer(); static SSLSocketFactory getSSLSocketFactory(); static X509TrustManager getTrustManager(); static RESTMockLogger getLogger(); synchronized static void init(RESTMockFileParser restMockFileParser, RESTMockLogger logger); synchronized static void init(RESTMockFileParser restMockFileParser, RESTMockLogger logger, RESTMockOptions restMockOptions); static void enableLogging(RESTMockLogger logger); static void disableLogging(); @Deprecated static void removeAllMatchableCalls(); static void reset(); static boolean removeMatchableCall(MatchableCall call); static void replaceMatchableCall(MatchableCall call, MatchableCall replacement); static String getUrl(); static void addMatchableCall(final MatchableCall call); static MatchableCall whenGET(Matcher<RecordedRequest> requestMatcher); static MatchableCall whenPOST(Matcher<RecordedRequest> requestMatcher); static MatchableCall whenPUT(Matcher<RecordedRequest> requestMatcher); static MatchableCall whenPATCH(Matcher<RecordedRequest> requestMatcher); static MatchableCall whenDELETE(Matcher<RecordedRequest> requestMatcher); static MatchableCall whenHEAD(Matcher<RecordedRequest> requestMatcher); static MatchableCall whenRequested(Matcher<RecordedRequest> requestMatcher); static void shutdown(); static final String RESPONSE_NOT_MOCKED; static final String MORE_THAN_ONE_RESPONSE_ERROR; }
@Test public void testMultipleMatches() throws Exception { String path = "sample"; RESTMockServer.whenRequested(pathEndsWith(path)).thenReturnString("multiple calls"); RESTMockServer.whenRequested(pathEndsWith(path)).thenReturnString("multiple calls another"); TestUtils.assertMultipleMatches(TestUtils.get(path)); TestUtils.assertMultipleMatches(TestUtils.post(path)); TestUtils.assertMultipleMatches(TestUtils.delete(path)); TestUtils.assertMultipleMatches(TestUtils.put(path)); }