<commit_before>/*
 * Copyright 2016 <EMAIL>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.gsdenys;

import com.github.gsdenys.runner.Configure;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;

/**
 * Test for the {@link CmisInMemoryRunner} class
 *
 * @author <NAME> (<EMAIL>)
 * @version 0.0.1
 * @since 0.0.1
 */
@RunWith(CmisInMemoryRunner.class)
@Configure(port = 8080)
public class CmisInMemoryRunnerTest {

    @Test
    public void getCmisURI() throws Exception {
        URI uriBase = CmisInMemoryRunner.getCmisURI();
        URI uriCompare = new URI("http://127.0.1.1:" + CmisInMemoryRunner.getCmisPort() + "/cmis/atom11");

        Assert.assertEquals("Both URLs must be equals", uriBase, uriCompare);
    }

    @Test
    public void testConnection() throws Exception {
        URL url = CmisInMemoryRunner.getCmisURI().toURL();
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Accept", "application/json");

        Assert.assertEquals("The Response code should be 200", conn.getResponseCode(), 200);

        BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

        Assert.assertNotNull("The buffered reader should be null", br);
<commit_msg>Code refactory<commit_after>/*
 * Copyright 2016 <EMAIL>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.gsdenys;

import com.github.gsdenys.runner.Configure;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;

/**
 * Test for the {@link CmisInMemoryRunner} class
 *
 * @author <NAME> (<EMAIL>)
 * @version 0.0.1
 * @since 0.0.1
 */
@RunWith(CmisInMemoryRunner.class)
@Configure(port = 8080)
public class CmisInMemoryRunnerTest {

    @Test
    public void getCmisURI() throws Exception {
        URI uriBase = CmisInMemoryRunner.getCmisURI();

        Assert.assertTrue("The URL should ends with ':8080/cmis/atom11'", uriBase.toString().endsWith(":8080/cmis/atom11"));
    }

    @Test
    public void testConnection() throws Exception {
        URL url = CmisInMemoryRunner.getCmisURI().toURL();
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Accept", "application/json");

        Assert.assertEquals("The Response code should be 200", conn.getResponseCode(), 200);

        BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

        Assert.assertNotNull("The buffered reader should be null", br);

{'fraction_non_alphanumeric': 0.10891089108910891, 'fraction_numerical': 0.017263264788017263, 'mean_word_length': 3.968474148802018, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 1, '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': '4042442', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1104, 'n_words': 353}