-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix consistent with declared orders when alphabetic is false, for issue #2959 * fix checkstyle
- Loading branch information
1 parent
a627c5f
commit 4686c2c
Showing
2 changed files
with
42 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
40 changes: 40 additions & 0 deletions
40
core/src/test/java/com/alibaba/fastjson2/issues_2900/Issue2959.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,40 @@ | ||
package com.alibaba.fastjson2.issues_2900; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import com.alibaba.fastjson2.JSONWriter; | ||
import com.alibaba.fastjson2.annotation.JSONType; | ||
import lombok.Data; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.Date; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class Issue2959 { | ||
@Test | ||
public void test() { | ||
assertEquals("{\"projectNO\":null,\"orderNO\":null,\"orderType\":null,\"pN\":null,\"qty\":null,\"description\":null,\"customerCode\":null,\"customerName\":null,\"currency\":null,\"netPrice\":null,\"uSD\":null,\"rate\":null,\"orderDate\":null,\"requestDate\":null,\"planedDate\":null,\"this$0\":null}", | ||
JSON.toJSONString(new TobeDelivery(), JSONWriter.Feature.WriteNulls)); | ||
} | ||
|
||
@Data | ||
@JSONType(alphabetic = false) | ||
public class TobeDelivery { | ||
private String projectNO; | ||
private String orderNO; | ||
private String orderType; | ||
private String pN; | ||
private Integer qty; | ||
private String description; | ||
private String customerCode; | ||
private String customerName; | ||
private String currency; | ||
private BigDecimal netPrice; | ||
private BigDecimal uSD; | ||
private Float rate; | ||
private Date orderDate; | ||
private Date requestDate; | ||
private Date planedDate; | ||
} | ||
} |