class HttpUtils {

    public static <T> ResponseProcessor<T> checkResponse(ResponseProcessor<T> processor,
                                                         Predicate<Response> successPredicate,
                                                         String tag) {
        return response -> {
            if (!successPredicate.test(response)) {
                throw createExceptionForResponse(response, tag);
            }
            return processor.process(response);
        };
    }

    private  HttpUtils();

}