<commit_before>/**
 * junit-interceptors: JUnit Interceptors Collection
 *
 * Copyright (c) 2009 by <NAME>.
 * This software is made available under the terms of the MIT License.
 *
 * Created Aug 28, 2009
 */
package junit.interceptors.httpserver;

import static java.net.HttpURLConnection.HTTP_OK;
import static org.junit.Assert.assertEquals;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

import org.junit.Rule;
import org.junit.Test;

/**
 * JUnit test case for {@link HttpServerInterceptor}.
 * 
 * @author <NAME>
 */
public final class HttpServerInterceptorTest {

    // CHECKSTYLE:OFF
    @Rule
    public final HttpServerInterceptor httpServer = new HttpServerInterceptor();

    // CHECKSTYLE:ON

    /**
     * @throws Exception
     *         on exception
     */
    @Test
    public void testHttpServerInterceptor() throws Exception {
        httpServer.addHandler("/", new SimpleHttpHandler() {

            protected void onGet() throws IOException {
                getResponseWriter().println("<?xml version=\"1.0\"?>");
                getResponseWriter().println("<resource id=\"1234\" name=\"test\" />");
                sendResponse(HTTP_OK);
            }
        });
        final HttpURLConnection connection = httpServer.get("/");
        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        assertEquals("<?xml version=\"1.0\"?>", in.readLine());
        assertEquals("<resource id=\"1234\" name=\"test\" />", in.readLine());
        assertEquals(HTTP_OK, connection.getResponseCode());
    }

}<commit_msg>Cosmetic<commit_after>/**
 * junit-interceptors: JUnit Interceptors Collection
 *
 * Copyright (c) 2009 by <NAME>.
 * This software is made available under the terms of the MIT License.
 *
 * Created Aug 28, 2009
 */
package junit.interceptors.httpserver;

import static java.net.HttpURLConnection.HTTP_OK;
import static org.junit.Assert.assertEquals;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

import org.junit.Rule;
import org.junit.Test;

/**
 * JUnit test case for {@link HttpServerInterceptor}.
 *
 * @author <NAME>
 */
public final class HttpServerInterceptorTest {

    // CHECKSTYLE:OFF
    @Rule
    public final HttpServerInterceptor httpServer = new HttpServerInterceptor();
    // CHECKSTYLE:ON

    /**
     * @throws Exception
     *         on exception
     */
    @Test
    public void testHttpServerInterceptor() throws Exception {
        httpServer.addHandler("/", new SimpleHttpHandler() {

            @Override
            protected void onGet() throws IOException {
                getResponseWriter().println("<?xml version=\"1.0\"?>");
                getResponseWriter().println("<resource id=\"1234\" name=\"test\" />");
                sendResponse(HTTP_OK);
            }
        });
        final HttpURLConnection connection = httpServer.get("/");
        final BufferedReader in =
                new BufferedReader(new InputStreamReader(connection.getInputStream()));
        assertEquals("<?xml version=\"1.0\"?>", in.readLine());
        assertEquals("<resource id=\"1234\" name=\"test\" />", in.readLine());
        assertEquals(HTTP_OK, connection.getResponseCode());
    }

}
{'fraction_non_alphanumeric': 0.12867756315007428, 'fraction_numerical': 0.013075780089153046, 'mean_word_length': 3.031137724550898, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 4, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3405163', 'n_tokens_mistral': 939, 'n_tokens_neox': 880, 'n_words': 220}