<commit_before>package org.nohope;

import org.joda.time.DateTime;
import org.junit.Test;
import org.nohope.test.SerializationUtils;

import static com.mongodb.util.MyAsserts.assertFalse;
import static com.mongodb.util.MyAsserts.assertTrue;
import static org.junit.Assert.assertEquals;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @since 2013-10-11 13:56
 */
public class SeriesElementTest {

    @Test
    @SuppressWarnings({"ObjectEqualsNull", "EqualsBetweenInconvertibleTypes"})
    public void serialization() {
        final DateTime date = DateTime.parse("2000-01-01T01:01:01.001");
        final SeriesElement<Integer> e = new SeriesElement<>(date, 1);
        assertEquals("{\"timestamp\":946666861001,\"value\":1}", e.toString());
        final SeriesElement<Integer> mongoCloned = SerializationUtils.assertMongoClonedEquals(e);
        final SeriesElement<Integer> javaCloned = SerializationUtils.assertJavaClonedEquals(e);

        assertTrue(date.isEqual(mongoCloned.getTimestamp()));
        assertTrue(date.isEqual(javaCloned.getTimestamp()));
        assertEquals(1, (int) mongoCloned.getValue());
        assertEquals(1, (int) javaCloned.getValue());<commit_msg>typetools: fix for timezone-dependent serialization test<commit_after>package org.nohope;

import org.joda.time.DateTime;
import org.junit.Test;
import org.nohope.test.SerializationUtils;

import static com.mongodb.util.MyAsserts.assertFalse;
import static com.mongodb.util.MyAsserts.assertTrue;
import static org.junit.Assert.assertEquals;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @since 2013-10-11 13:56
 */
public class SeriesElementTest {

    @Test
    @SuppressWarnings({"ObjectEqualsNull", "EqualsBetweenInconvertibleTypes"})
    public void serialization() {
        final DateTime date = DateTime.parse("2000-01-01T01:01:01.001Z");
        final SeriesElement<Integer> e = new SeriesElement<>(date, 1);
        assertEquals("{\"timestamp\":946688461001,\"value\":1}", e.toString());
        final SeriesElement<Integer> mongoCloned = SerializationUtils.assertMongoClonedEquals(e);
        final SeriesElement<Integer> javaCloned = SerializationUtils.assertJavaClonedEquals(e);

        assertTrue(date.isEqual(mongoCloned.getTimestamp()));
        assertTrue(date.isEqual(javaCloned.getTimestamp()));
        assertEquals(1, (int) mongoCloned.getValue());
        assertEquals(1, (int) javaCloned.getValue());
{'fraction_non_alphanumeric': 0.13553719008264462, 'fraction_numerical': 0.0371900826446281, 'mean_word_length': 4.861985472154964, 'pattern_counts': {'":': 4, '<': 19, '<?xml version=': 0, '>': 19, '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': '2769451', 'n_tokens_mistral': 774, 'n_tokens_neox': 721, 'n_words': 124}