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)));
    }

}

@@ -31,16 +31,70 @@
 model;%0A%0A
+import com.fasterxml.jackson.core.type.TypeReference;%0A
 import c
@@ -129,16 +129,16 @@
 stUtil;%0A
-
 import o
@@ -219,16 +219,39 @@
 rayList;
+%0Aimport java.util.List;
 %0A%0Apublic
@@ -303,14 +303,17 @@
 test
-Method
+TestClass
 ()%0A 
@@ -575,24 +575,24 @@
 st_name%22);%0A%0A
-
         Asse
@@ -650,32 +650,614 @@
 %5C%22:1%7D%22);%0A    %7D%0A%0A
+    @Test%0A    public void testLists()%0A            throws Exception%0A    %7B%0A        TestClass obj1 = new TestClass(%22test_name1%22, 1);%0A        TestClass obj2 = new TestClass(%22test_name2%22, 2);%0A%0A        List%3CTestClass%3E objList = new ArrayList%3CTestClass%3E();%0A%0A        objList.add(obj1);%0A        objList.add(obj2);%0A%0A        String json = TestUtil.serialize(objList);%0A        List%3CTestClass%3E newList = TestUtil.MAPPER.readValue(json, new TypeReference%3CList%3CTestClass%3E%3E()%7B%7D);%0A%0A        Assert.assertEquals(json, %22%5B%7B%5C%22name%5C%22:%5C%22test_name1%5C%22,%5C%22id%5C%22:1%7D,%7B%5C%22name%5C%22:%5C%22test_name2%5C%22,%5C%22id%5C%22:2%7D%5D%22);%0A    %7D%0A%0A
     @Test%0A    pu

Add test for serializing a List<TestClass>.