<commit_before>package com.github.paweladamski;

import com.github.paweladamski.action.ExceptionAction;
import com.github.paweladamski.action.StatusResponse;
import com.github.paweladamski.action.StringResponse;
import com.github.paweladamski.condition.BodyMatcher;
import com.github.paweladamski.condition.HeaderCondition;
import com.github.paweladamski.condition.ParameterCondition;
import org.hamcrest.Matcher;

import java.io.IOException;

import static org.hamcrest.Matchers.equalTo;

public class HttpClientMockBuilder extends HttpClientMock {

    private final Rule newRule;

    public HttpClientMockBuilder(Rule rule) {
        this.newRule = rule;
    }

    public HttpClientMockBuilder withHeader(String header, String value) {
        newRule.addCondition(new HeaderCondition(header, equalTo(value)));
        return this;
    }

    public HttpClientMockBuilder withParameter(String parameter, String value) {
        newRule.addCondition(new ParameterCondition(parameter, equalTo(value)));
        return this;
    }

    public HttpClientMockBuilder doReturn(String response) {
        newRule.addAction(new StringResponse(response));
        return this;
    }

    public void doReturnStatus(int statusCode) {
        newRule.addAction(new StatusResponse(statusCode));
    }

    public HttpClientMockBuilder doThrowException(IOException e) {
        newRule.addAction(new ExceptionAction(e));
        return this;
    }

    HttpClientMockBuilder withBody(Matcher<String> foo) {
        newRule.addCondition(new BodyMatcher(foo));
        return this;
    }
}
<commit_msg>BodyMatcher and code format<commit_after>package com.github.paweladamski;

import com.github.paweladamski.action.ExceptionAction;
import com.github.paweladamski.action.StatusResponse;
import com.github.paweladamski.action.StringResponse;
import com.github.paweladamski.condition.BodyMatcher;
import com.github.paweladamski.condition.HeaderCondition;
import com.github.paweladamski.condition.ParameterCondition;
import org.hamcrest.Matcher;

import java.io.IOException;

import static org.hamcrest.Matchers.equalTo;

public class HttpClientMockBuilder extends HttpClientMock {

    private final Rule newRule;

    public HttpClientMockBuilder(Rule rule) {
        this.newRule = rule;
    }

    public HttpClientMockBuilder withHeader(String header, String value) {
        newRule.addCondition(new HeaderCondition(header, equalTo(value)));
        return this;
    }

    public HttpClientMockBuilder withParameter(String parameter, String value) {
        newRule.addCondition(new ParameterCondition(parameter, equalTo(value)));
        return this;
    }

    public HttpClientMockBuilder doReturn(String response) {
        newRule.addAction(new StringResponse(response));
        return this;
    }

    public void doReturnStatus(int statusCode) {
        newRule.addAction(new StatusResponse(statusCode));
    }

    public HttpClientMockBuilder doThrowException(IOException e) {
        newRule.addAction(new ExceptionAction(e));
        return this;
    }

    public HttpClientMockBuilder withBody(Matcher<String> foo) {
        newRule.addCondition(new BodyMatcher(foo));
        return this;
    }
}

{'fraction_non_alphanumeric': 0.08174726989079563, 'fraction_numerical': 0.0, 'mean_word_length': 4.113237639553429, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7249362', 'n_tokens_mistral': 906, 'n_tokens_neox': 889, 'n_words': 176}