Skip to content

Commit

Permalink
add testcase for issue #2153
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Jan 5, 2024
1 parent b6d6db9 commit 5557158
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.alibaba.fastjson2.issues_2100;

import com.alibaba.fastjson2.JSON;
import lombok.Getter;
import lombok.Setter;
import org.junit.jupiter.api.Test;

import java.io.Serializable;
import java.util.Date;

public class Issue2153 {
@Test
public void test() {
String str = "{\"addTime\":1703124696338,\"updateTime\":1703124696338,\"id\":7}";
User user = JSON.parseObject(str, User.class);
System.out.println(user.toString());
}

public interface ID extends Serializable {
Serializable getId();
}

public interface Bean<K extends Serializable> extends ID {
@Override
K getId();

void setId(K id);
}

@Getter
@Setter
public static abstract class BaseEntity implements Bean<Long> {
Long id;
}

@Getter
@Setter
public static abstract class TimeBaseEntity extends BaseEntity {
Date addTime;
Date updateTime;
}

@Getter
@Setter
public static class User extends BaseEntity {
String addr;
Long a, b, c, d, e, f, g;
}
}

0 comments on commit 5557158

Please sign in to comment.