Skip to content

Commit

Permalink
add testcase for issue #2229
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Jan 26, 2019
1 parent 7170a89 commit e44c603
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/java/com/alibaba/json/bvt/issue_2200/Issue2229.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.alibaba.json.bvt.issue_2200;

import com.alibaba.fastjson.JSON;
import junit.framework.TestCase;

import java.util.Date;

public class Issue2229 extends TestCase {
public void test_for_issue() throws Exception {
Jon jon = JSON.parseObject("{\"dStr\":\" hahahaha \",\"user\":{\"createtime\":null,\"id\":0,\"username\":\" asdfsadf asdf asdf \"}}", Jon.class);
assertEquals(" asdfsadf asdf asdf ", jon.user.username);
}

public void test_for_issue1() throws Exception {
Jon jon1 = JSON.parseObject("{'dStr':' hahahaha ','user':{'createtime':null,'id':0,'username':' asdfsadf asdf asdf '}}", Jon.class);
assertEquals(" asdfsadf asdf asdf ", jon1.user.username);
}

public static class Jon {
public String dStr;
public User user;
}

public static class User {
public int id;
public Date createtime;
public String username;
}
}

0 comments on commit e44c603

Please sign in to comment.