<commit_before>package com.ksmpartners.ernie.model;

import com.ksmpartners.ernie.util.TestUtil;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.ArrayList;

public class TestTest {

    @Test
    public void testMethod()
        throws Exception
    {
        TestClass obj = new TestClass("test_name", 1);

        String json = TestUtil.serialize(obj);
        TestClass newObj = TestUtil.deserialize(json, TestClass.class);

        Assert.assertEquals(newObj.getName(), "test_name");

        Assert.assertEquals(json, "{\"name\":\"test_name\",\"id\":1}");
    }

    @Test
    public void testVerify()
        throws Exception
    {
        TestUtil.verifySerialization(TestClass.class);
    }

    @Test
    public void testEqual()
        throws Exception
    {
        Assert.assertFalse(TestUtil.equal(new TestClass("name", 1), new TestClass("name1", 2)));
        Assert.assertTrue(TestUtil.equal(new TestClass("name", 1), new TestClass("name", 1)));
        Assert.assertTrue(TestUtil.equal(TestClass.class.newInstance(), TestClass.class.newInstance()));
        Assert.assertFalse(TestUtil.equal("test string", Integer.valueOf(1)));
    }

}<commit_msg>Add test for serializing a List<TestClass>.<commit_after>package com.ksmpartners.ernie.model;

import com.fasterxml.jackson.core.type.TypeReference;
import com.ksmpartners.ernie.util.TestUtil;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.List;

public class TestTest {

    @Test
    public void testTestClass()
        throws Exception
    {
        TestClass obj = new TestClass("test_name", 1);

        String json = TestUtil.serialize(obj);
        TestClass newObj = TestUtil.deserialize(json, TestClass.class);

        Assert.assertEquals(newObj.getName(), "test_name");

        Assert.assertEquals(json, "{\"name\":\"test_name\",\"id\":1}");
    }

    @Test
    public void testLists()
            throws Exception
    {
        TestClass obj1 = new TestClass("test_name1", 1);
        TestClass obj2 = new TestClass("test_name2", 2);

        List<TestClass> objList = new ArrayList<TestClass>();

        objList.add(obj1);
        objList.add(obj2);

        String json = TestUtil.serialize(objList);
        List<TestClass> newList = TestUtil.MAPPER.readValue(json, new TypeReference<List<TestClass>>(){});

        Assert.assertEquals(json, "[{\"name\":\"test_name1\",\"id\":1},{\"name\":\"test_name2\",\"id\":2}]");
    }

    @Test
    public void testVerify()
        throws Exception
    {
        TestUtil.verifySerialization(TestClass.class);
    }

    @Test
    public void testEqual()
        throws Exception
    {
        Assert.assertFalse(TestUtil.equal(new TestClass("name", 1), new TestClass("name1", 2)));
        Assert.assertTrue(TestUtil.equal(new TestClass("name", 1), new TestClass("name", 1)));
        Assert.assertTrue(TestUtil.equal(TestClass.class.newInstance(), TestClass.class.newInstance()));
        Assert.assertFalse(TestUtil.equal("test string", Integer.valueOf(1)));
    }

}
{'fraction_non_alphanumeric': 0.14160725858716786, 'fraction_numerical': 0.009073233959818535, 'mean_word_length': 3.2403846153846154, 'pattern_counts': {'":': 8, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '5012521', 'n_tokens_mistral': 936, 'n_tokens_neox': 910, 'n_words': 171}