mirror of
				https://gitee.com/dromara/hutool.git
				synced 2025-10-31 16:36:56 +08:00 
			
		
		
		
	修复JSONUtil.toBean()中将JSON数组字符串转Map对象返回错误问题(issue#3795@Github)
This commit is contained in:
		
							
								
								
									
										17
									
								
								hutool-json/src/test/java/cn/hutool/json/Issue3795Test.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								hutool-json/src/test/java/cn/hutool/json/Issue3795Test.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| package cn.hutool.json; | ||||
|  | ||||
| import cn.hutool.core.lang.TypeReference; | ||||
| import org.junit.jupiter.api.Assertions; | ||||
| import org.junit.jupiter.api.Test; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| public class Issue3795Test { | ||||
| 	@Test | ||||
| 	void toBeanTest() { | ||||
| 		String fieldMapping = "[{\"lable\":\"id\",\"value\":\"id\"},{\"lable\":\"name\",\"value\":\"name\"},{\"lable\":\"age\",\"value\":\"age\"}]"; | ||||
| 		Assertions.assertThrows(UnsupportedOperationException.class, ()->{ | ||||
| 			JSONUtil.toBean(fieldMapping, new TypeReference<Map<String, String>>() {}, false); | ||||
| 		}); | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Looly
					Looly