package com.alibaba.json.bvt.parser.deser;

import junit.framework.Assert;
import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;

public class StackTraceElementDeserializerTest extends TestCase {

    public void test_stack() throws Exception {
        Assert.assertNull(JSON.parseObject("null", StackTraceElement.class));
        Assert.assertNull(JSON.parseArray("null", StackTraceElement.class));
        Assert.assertNull(JSON.parseArray("[null]", StackTraceElement.class).get(0));
        Assert.assertNull(JSON.parseObject("{\"value\":null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{\"className\":\"int\",\"methodName\":\"parseInt\"}", StackTraceElement.class).getFileName());
    }

    public static class VO {

        private StackTraceElement value;

        public StackTraceElement getValue() {
            return value;
        }

        public void setValue(StackTraceElement value) {
            this.value = value;
        }

    }
}

@@ -135,16 +135,59 @@
 on.JSON;
+%0Aimport com.alibaba.fastjson.JSONException;
 %0A%0Apublic
@@ -723,47 +723,1229 @@
 %22%7D%22,
- StackTraceElement.class).getFileName()
+%0A                                           StackTraceElement.class).getFileName());%0A        %0A        Assert.assertEquals(StackTraceElement.class, ((StackTraceElement) JSON.parse(%22%7B%5C%22@type%5C%22:%5C%22java.lang.StackTraceElement%5C%22,%5C%22className%5C%22:%5C%22int%5C%22,%5C%22methodName%5C%22:%5C%22parseInt%5C%22%7D%22)).getClass());%0A    %7D%0A%0A    public void test_stack_error() throws Exception %7B%0A        Exception error = null;%0A        try %7B%0A            JSON.parseObject(%22%7B%7D%22, StackTraceElement.class);%0A        %7D catch (JSONException ex) %7B%0A            error = ex;%0A        %7D%0A        Assert.assertNotNull(error);%0A    %7D%0A    %0A    public void test_stack_error_1() throws Exception %7B%0A        Exception error = null;%0A        try %7B%0A            JSON.parseObject(%22%5B%5D%22, StackTraceElement.class);%0A        %7D catch (JSONException ex) %7B%0A            error = ex;%0A        %7D%0A        Assert.assertNotNull(error);%0A    %7D%0A    %0A    public void test_stack_error_2() throws Exception %7B%0A        Exception error = null;%0A        try %7B%0A            JSON.parseObject(%22%7B%5C%22className%5C%22:null,%5C%22methodName%5C%22:null,%5C%22fileName%5C%22:null,%5C%22lineNumber%5C%22:null,%5C%22@type%5C%22:%5C%22xxx%5C%22%7D%22, StackTraceElement.class);%0A        %7D catch (JSONException ex) %7B%0A            error = ex;%0A        %7D%0A        Assert.assertNotNull(error
 );%0A 
@@ -2210,10 +2210,9 @@
 %0A%0A    %7D%0A
+
 %7D
-%0A

add testcase