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

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

public class IntegerFieldDeserializerTest2 extends TestCase {
	
	protected void setUp() throws Exception {
//		ParserConfig.getGlobalInstance().setAsmEnable(false);
	}
	
	public void test_integer() throws Exception {
		String text = "{\"value\":{\"column1\":\"aa\"}}";
		Map<String, Entity> map = JSON.parseObject(text, new TypeReference<Map<String, Entity>>(){});
		Assert.assertNotNull(map);
		Assert.assertNotNull(map.get("value"));
		Assert.assertNotNull("aa", map.get("value").getColumn1());
	}
	
	public void f_test_integer_2() throws Exception {
		String text = "[{\"value\":{\"column1\":\"aa\"}}]";
		List<Map<String, Entity>> mapList = JSON.parseObject(text, new TypeReference<List<Map<String, Entity>>>(){});
		Map<String, Entity> map = mapList.get(0);
		Assert.assertNotNull(map);
		Assert.assertNotNull(map.get("value"));
		Assert.assertNotNull("aa", map.get("value").getColumn1());
	}

	public static class Entity implements Serializable {
		private static final long serialVersionUID = 1L;
		private String column1;
		private Integer column3;

		public String getColumn1() {
			return column1;
		}

		public void setColumn1(String column1) {
			this.column1 = column1;
		}

		public Integer getColumn3() {
			return column3;
		}

		public void setColumn3(Integer column3) {
			this.column3 = column3;
		}
	}
	
	public static class Value {
		
	}
}

@@ -769,10 +769,8 @@
 oid 
-f_
 test
@@ -793,32 +793,32 @@
 ows Exception %7B%0A
+
 %09%09String text = 
@@ -1074,32 +1074,32 @@
 .get(%22value%22));%0A
-
 %09%09Assert.assertN
@@ -1145,16 +1145,581 @@
 1());%0A%09%7D
+%0A%09%0A%09public void test_integer_3() throws Exception %7B%0A%09%09String text = %22%7B%5C%22value%5C%22:%7B%5C%22valueA%5C%22:%7B%5C%22column1%5C%22:%5C%22aa%5C%22%7D, %5C%22valueB%5C%22:%7B%5C%22column1%5C%22:%5C%22bb%5C%22%7D%7D%7D%22;%0A%09%09Map%3CString, Map%3CString, Entity%3E%3E mapmap = JSON.parseObject(text, new TypeReference%3CMap%3CString, Map%3CString, Entity%3E%3E%3E()%7B%7D);%0A%09%09Map%3CString, Entity%3E map = mapmap.get(%22value%22);%0A%09%09Assert.assertNotNull(map);%0A%09%09Assert.assertNotNull(map.get(%22valueA%22));%0A%09%09Assert.assertNotNull(%22aa%22, map.get(%22valueA%22).getColumn1());%0A%09%09Assert.assertNotNull(map.get(%22valueB%22));%0A%09%09Assert.assertNotNull(%22bb%22, map.get(%22valueB%22).getColumn1());%0A%09%7D
 %0A%0A%09publi

add testcase