<commit_before>package org.zalando.nakadi.webservice;

import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Response;
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.zalando.nakadi.domain.EventType;
import org.zalando.nakadi.webservice.utils.NakadiTestUtils;

import java.text.MessageFormat;

import static com.jayway.restassured.RestAssured.given;

public class EventPublishingAT extends BaseAT {

    @Test
    public void whenPublishingEventTooLargeThen422() throws Exception {
        final EventType eventType = NakadiTestUtils.createEventType();

        publishLargeEvent(eventType)
                .then()
                .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY);
    }

    private Response publishLargeEvent(final EventType eventType) {
        StringBuilder sb = new StringBuilder();
        sb.append("[{\"blah\":\"");
        for (int i = 0; i < 1000010; i++) {
            sb.append("a");
        }
        sb.append("\"}]");
        return given()
                .body(sb.toString())
                .contentType(ContentType.JSON)
                .post(MessageFormat.format("/event-types/{0}/events", eventType.getName()));
    }<commit_msg>ARUHA-473 Fix checkstyle<commit_after>package org.zalando.nakadi.webservice;

import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Response;
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.zalando.nakadi.domain.EventType;
import org.zalando.nakadi.webservice.utils.NakadiTestUtils;

import java.text.MessageFormat;

import static com.jayway.restassured.RestAssured.given;

public class EventPublishingAT extends BaseAT {

    @Test
    public void whenPublishingEventTooLargeThen422() throws Exception {
        final EventType eventType = NakadiTestUtils.createEventType();

        publishLargeEvent(eventType)
                .then()
                .statusCode(HttpStatus.SC_UNPROCESSABLE_ENTITY);
    }

    private Response publishLargeEvent(final EventType eventType) {
        final StringBuilder sb = new StringBuilder();
        sb.append("[{\"blah\":\"");
        for (int i = 0; i < 1000010; i++) {
            sb.append("a");
        }
        sb.append("\"}]");
        return given()
                .body(sb.toString())
                .contentType(ContentType.JSON)
                .post(MessageFormat.format("/event-types/{0}/events", eventType.getName()));
    }
{'fraction_non_alphanumeric': 0.11771894093686354, 'fraction_numerical': 0.010997963340122199, 'mean_word_length': 2.9549114331723025, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, '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': '3231172', 'n_tokens_mistral': 753, 'n_tokens_neox': 704, 'n_words': 127}