<commit_before>package com.cyrillrx.tracker.event;

import com.cyrillrx.tracker.TestUtils;

import org.junit.Assert;
import org.junit.Test;

/**
 * @author <NAME>
 *         Created on 25/04/2016.
 */
public class TrackEventTest {

    @Test
    public void testBuildEvent() {

        final TrackEvent event = new TrackEvent.Builder()
                .setContext(TestUtils.createFakeContext())
                .setCategory(TestUtils.EVENT_CATEGORY)
                .setName(TestUtils.EVENT_NAME)
                .setSource(TestUtils.EVENT_SOURCE)
                .putCustomAttribute(TestUtils.KEY_1, TestUtils.VALUE_1)
                .putCustomAttribute(TestUtils.KEY_2, TestUtils.VALUE_2)
                .build();

        TestUtils.assertTrackEventConsistency(event);
    }

    @Test
    public void testBuildRatingEvent() {

        final TrackEvent event = new TrackEvent.Builder()
                .setContext(TestUtils.createFakeContext())
                .setCategory(TestUtils.EVENT_CATEGORY)
                .setName(TestUtils.EVENT_NAME)
                .setSource(TestUtils.EVENT_SOURCE)
                .putCustomAttribute(TestUtils.KEY_1, TestUtils.VALUE_1)
                .putCustomAttribute(TestUtils.KEY_2, TestUtils.VALUE_2)
                .putCustomAttribute("string", "toto")
                .putCustomAttribute("float", Float.MAX_VALUE)
                .putCustomAttribute("long", Long.MAX_VALUE)
                .putCustomAttribute("int", Integer.MAX_VALUE)
                .build();

        TestUtils.assertTrackEventConsistency(event);

        final String string = event.getCustomAttribute("string");
        Assert.assertEquals("Attribute is inconsistent.", "toto", string);

        final float floatValue = event.getCustomAttribute("float");
        Assert.assertEquals("Attribute is inconsistent.", Float.MAX_VALUE, floatValue);<commit_msg>Fixed unit tests<commit_after>package com.cyrillrx.tracker.event;

import com.cyrillrx.tracker.TestUtils;

import org.junit.Assert;
import org.junit.Test;

/**
 * @author <NAME>
 *         Created on 25/04/2016.
 */
public class TrackEventTest {

    @Test
    public void testBuildEvent() {

        final TrackEvent event = new TrackEvent.Builder()
                .setContext(TestUtils.createFakeContext())
                .setCategory(TestUtils.EVENT_CATEGORY)
                .setName(TestUtils.EVENT_NAME)
                .setSource(TestUtils.EVENT_SOURCE)
                .putCustomAttribute(TestUtils.KEY_1, TestUtils.VALUE_1)
                .putCustomAttribute(TestUtils.KEY_2, TestUtils.VALUE_2)
                .build();

        TestUtils.assertTrackEventConsistency(event);
    }

    @Test
    public void testBuildRatingEvent() {

        final TrackEvent event = new TrackEvent.Builder()
                .setContext(TestUtils.createFakeContext())
                .setCategory(TestUtils.EVENT_CATEGORY)
                .setName(TestUtils.EVENT_NAME)
                .setSource(TestUtils.EVENT_SOURCE)
                .putCustomAttribute(TestUtils.KEY_1, TestUtils.VALUE_1)
                .putCustomAttribute(TestUtils.KEY_2, TestUtils.VALUE_2)
                .putCustomAttribute("string", "toto")
                .putCustomAttribute("float", Float.MAX_VALUE)
                .putCustomAttribute("long", Long.MAX_VALUE)
                .putCustomAttribute("int", Integer.MAX_VALUE)
                .build();

        TestUtils.assertTrackEventConsistency(event);

        final String string = event.getCustomAttribute("string");
        Assert.assertEquals("Attribute is inconsistent.", "toto", string);

        final float floatValue = event.getCustomAttribute("float");
        Assert.assertEquals("Attribute is inconsistent.", Float.MAX_VALUE, floatValue, 0.1f);
{'fraction_non_alphanumeric': 0.1005586592178771, 'fraction_numerical': 0.009044958765629156, 'mean_word_length': 2.4150772025431424, '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': '6816836', 'n_tokens_mistral': 1067, 'n_tokens_neox': 991, 'n_words': 162}