WebServiceClient { static HTTPStatus parseHTTPStatus(int statusCode) { HTTPStatus status = HTTP_STATUSES.get(statusCode); if (status == null) throw new Error("unsupported http status code, code=" + statusCode); return status; } WebServiceClient(String serviceURL, HTTPClient httpClient, RequestBeanWriter writer, ResponseBeanReader reader); Object execute(HTTPMethod method, String path, Class<T> requestBeanClass, T requestBean, Type responseType); void intercept(WebServiceClientInterceptor interceptor); void logCallWebService(String method); static final String USER_AGENT; }
@Test void parseHTTPStatus() { assertThat(WebServiceClient.parseHTTPStatus(200)).isEqualTo(HTTPStatus.OK); }
@Test void parseUnsupportedHTTPStatus() { assertThatThrownBy(() -> WebServiceClient.parseHTTPStatus(525)) .isInstanceOf(Error.class); }