mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix test and regex
This commit is contained in:
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.convert.ConvertException;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
@@ -13,7 +12,6 @@ import cn.hutool.json.test.bean.JsonNode;
|
||||
import cn.hutool.json.test.bean.KeyBean;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -84,7 +82,6 @@ public class JSONArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void parseBeanListTest() {
|
||||
KeyBean b1 = new KeyBean();
|
||||
b1.setAkey("aValue1");
|
||||
@@ -96,7 +93,8 @@ public class JSONArrayTest {
|
||||
ArrayList<KeyBean> list = CollUtil.newArrayList(b1, b2);
|
||||
|
||||
JSONArray jsonArray = JSONUtil.parseArray(list);
|
||||
Console.log(jsonArray);
|
||||
Assert.assertEquals("aValue1", jsonArray.getJSONObject(0).getStr("akey"));
|
||||
Assert.assertEquals("bValue2", jsonArray.getJSONObject(1).getStr("bkey"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -588,4 +588,11 @@ public class JSONObjectTest {
|
||||
jsonObject.accumulate("key1", "value3");
|
||||
Assert.assertEquals("{\"key1\":[\"value1\",\"value2\",\"value3\"]}", jsonObject.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void putByPathTest() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.putByPath("aa.bb", "BB");
|
||||
Assert.assertEquals("{\"aa\":{\"bb\":\"BB\"}}", json.toString());
|
||||
}
|
||||
}
|
||||
|
@@ -143,13 +143,6 @@ public class JSONUtilTest {
|
||||
// Assert.assertEquals("{\"age\":18,\"gender\":\"男\"}", user.getProp());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void putByPathTest() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.putByPath("aa.bb", "BB");
|
||||
Assert.assertEquals("{\"aa\":{\"bb\":\"BB\"}}", json.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getStrTest() {
|
||||
String html = "{\"name\":\"Something must have been changed since you leave\"}";
|
||||
|
@@ -1,16 +1,10 @@
|
||||
package cn.hutool.json.test.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ADT {
|
||||
|
||||
private List<String> BookingCode;
|
||||
|
||||
public void setBookingCode(List<String> BookingCode) {
|
||||
this.BookingCode = BookingCode;
|
||||
}
|
||||
|
||||
public List<String> getBookingCode() {
|
||||
return BookingCode;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
package cn.hutool.json.test.bean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Exam {
|
||||
private String id;
|
||||
private String examNumber;
|
||||
@@ -9,59 +10,4 @@ public class Exam {
|
||||
private Seq[] answerArray;
|
||||
private String isRight;
|
||||
private String isSubject;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getExamNumber() {
|
||||
return examNumber;
|
||||
}
|
||||
|
||||
public void setExamNumber(String examNumber) {
|
||||
this.examNumber = examNumber;
|
||||
}
|
||||
|
||||
public String getIsAnswer() {
|
||||
return isAnswer;
|
||||
}
|
||||
|
||||
public void setIsAnswer(String isAnswer) {
|
||||
this.isAnswer = isAnswer;
|
||||
}
|
||||
|
||||
public Seq[] getAnswerArray() {
|
||||
return answerArray;
|
||||
}
|
||||
|
||||
public void setAnswerArray(Seq[] answerArray) {
|
||||
this.answerArray = answerArray;
|
||||
}
|
||||
|
||||
public String getIsRight() {
|
||||
return isRight;
|
||||
}
|
||||
|
||||
public void setIsRight(String isRight) {
|
||||
this.isRight = isRight;
|
||||
}
|
||||
|
||||
public String getIsSubject() {
|
||||
return isSubject;
|
||||
}
|
||||
|
||||
public void setIsSubject(String isSubject) {
|
||||
this.isSubject = isSubject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Exam [id=" + id + ", examNumber=" + examNumber + ", isAnswer=" + isAnswer + ", answerArray=" + Arrays.toString(answerArray) + ", isRight=" + isRight + ", isSubject=" + isSubject + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,24 +1,9 @@
|
||||
package cn.hutool.json.test.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class KeyBean{
|
||||
private String akey;
|
||||
private String bkey;
|
||||
|
||||
public String getAkey() {
|
||||
return akey;
|
||||
}
|
||||
public void setAkey(String akey) {
|
||||
this.akey = akey;
|
||||
}
|
||||
public String getBkey() {
|
||||
return bkey;
|
||||
}
|
||||
public void setBkey(String bkey) {
|
||||
this.bkey = bkey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KeyBean [akey=" + akey + ", bkey=" + bkey + "]";
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +1,10 @@
|
||||
package cn.hutool.json.test.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Price {
|
||||
|
||||
private List<List<ADT>> ADT;
|
||||
|
||||
public void setADT(List<List<ADT>> ADT) {
|
||||
this.ADT = ADT;
|
||||
}
|
||||
|
||||
public List<List<ADT>> getADT() {
|
||||
return ADT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user