-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.alibaba.json.bvt.bug; | ||
|
||
import java.util.List; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.annotation.JSONField; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class Bug_for_issue_555 extends TestCase { | ||
|
||
public void test_for_issue() throws Exception { | ||
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class); | ||
} | ||
|
||
public static class A { | ||
|
||
public List<B> list; | ||
} | ||
|
||
public static class B { | ||
|
||
@JSONField(serialize = true, deserialize = false) | ||
public Spec spec; | ||
} | ||
|
||
public static class Spec { | ||
private int id; | ||
|
||
public Spec(int id) { | ||
this.id = id; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.alibaba.json.bvt.bug; | ||
|
||
import java.util.List; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.annotation.JSONField; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class Bug_for_issue_555_setter extends TestCase { | ||
|
||
public void test_for_issue() throws Exception { | ||
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class); | ||
} | ||
|
||
public static class A { | ||
|
||
public List<B> list; | ||
} | ||
|
||
public static class B { | ||
|
||
@JSONField(serialize = true, deserialize = false) | ||
private Spec spec; | ||
|
||
public Spec getSpec() { | ||
return spec; | ||
} | ||
|
||
public void setSpec(Spec spec) { | ||
this.spec = spec; | ||
} | ||
|
||
} | ||
|
||
public static class Spec { | ||
|
||
private int id; | ||
|
||
public Spec(int id){ | ||
this.id = id; | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.alibaba.json.bvt.bug; | ||
|
||
import java.util.List; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.annotation.JSONField; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class Bug_for_issue_555_setter2 extends TestCase { | ||
|
||
public void test_for_issue() throws Exception { | ||
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class); | ||
} | ||
|
||
public static class A { | ||
|
||
public List<B> list; | ||
} | ||
|
||
public static class B { | ||
|
||
private Spec spec; | ||
|
||
@JSONField(serialize = true, deserialize = false) | ||
public Spec getSpec() { | ||
return spec; | ||
} | ||
|
||
@JSONField(serialize = true, deserialize = false) | ||
public void setSpec(Spec spec) { | ||
this.spec = spec; | ||
} | ||
|
||
} | ||
|
||
public static class Spec { | ||
|
||
private int id; | ||
|
||
public Spec(int id){ | ||
this.id = id; | ||
} | ||
} | ||
} |