@Override public SingleServedStubResult getServedStub(UUID id) { return executeRequest( adminRoutes.requestSpecForTask(GetServedStubTask.class), PathParams.single("id", id), SingleServedStubResult.class); }
@Override @SuppressWarnings("unchecked") public SingleStubMappingResult getStubMapping(UUID id) { return executeRequest( adminRoutes.requestSpecForTask(GetStubMappingTask.class), PathParams.single("id", id), SingleStubMappingResult.class); }
@Override public void addStubMapping(StubMapping stubMapping) { if (stubMapping.getRequest().hasCustomMatcher()) { throw new AdminException( "Custom matchers can't be used when administering a remote WireMock server. " + "Use WireMockRule.stubFor() or WireMockServer.stubFor() to administer the local instance."); } executeRequest( adminRoutes.requestSpecForTask(CreateStubMappingTask.class), PathParams.empty(), stubMapping, Void.class, 201); }
private <B, R> R executeRequest(RequestSpec requestSpec, Class<R> responseType) { return executeRequest(requestSpec, PathParams.empty(), null, responseType, 200); }
private void executeRequest(RequestSpec requestSpec) { executeRequest(requestSpec, PathParams.empty(), null, Void.class, 200); }