<commit_before>package com.brimarx.servicebox.services;

import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * Created by vincent on 16/08/15.
 */
public class HealthServiceTest {
    private HealthService srv = new HealthService();

    @Test
    public void testCheck()
    {
        Assert.assertEquals(srv.check(), "up");
    }

    @Test
    public void testCheckOrFail()
    {
        double ratio=0.5;
        double sum=0;
        int iter=1000;
        for (int i = iter; i > 0; i--) {
            try {
                srv.checkOrFail(ratio); // 50% chance of success
                sum+=1;
            } catch (RuntimeException e) {
                // ignore
            }
        }
        double mean = sum / iter;
        // Check mean with +/-5%
        Assert.assertTrue( mean < ratio*1.05 && mean > ratio*0.95, "failed with mean="+mean);
    }
}<commit_msg>increase HealthServiceTest iterations to avoid random errors<commit_after>package com.brimarx.servicebox.services;

import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * Created by vincent on 16/08/15.
 */
public class HealthServiceTest {
    private HealthService srv = new HealthService();

    @Test
    public void testCheck()
    {
        Assert.assertEquals(srv.check(), "up");
    }

    @Test
    public void testCheckOrFail()
    {
        double ratio=0.5;
        double sum=0;
        int iter=10000;
        for (int i = iter; i > 0; i--) {
            try {
                srv.checkOrFail(ratio); // 50% chance of success
                sum+=1;
            } catch (RuntimeException e) {
                // ignore
            }
        }
        double mean = sum / iter;
        // Check mean with +/-5%
        Assert.assertTrue( mean < ratio*1.05 && mean > ratio*0.95, "failed with mean="+mean);
    }
}
{'fraction_non_alphanumeric': 0.12021857923497267, 'fraction_numerical': 0.026775956284153007, 'mean_word_length': 1.8039816232771821, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4741232', 'n_tokens_mistral': 579, 'n_tokens_neox': 540, 'n_words': 144}