Skip to content

Commit

Permalink
Merge pull request #375 from RomanPrudkogliad/master
Browse files Browse the repository at this point in the history
fix int in shared_users json serialization
  • Loading branch information
pengrad authored Apr 16, 2024
2 parents 4b8396d + 90590ca commit 920f176
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class UsersShared implements Serializable {
private final static long serialVersionUID = 0L;

private Integer request_id;
private Integer[] user_ids;
private Long[] user_ids;
private SharedUser[] users;

public Integer requestId() {
Expand All @@ -25,7 +25,7 @@ public SharedUser[] users() {
* @deprecated Use {@link UsersShared#users()} instead
*/
@Deprecated
public Integer[] userIds() {
public Long[] userIds() {
return user_ids;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public class SharedUser implements Serializable {

private final static long serialVersionUID = 0L;

private Integer user_id;
private Long user_id;
private String first_name;
private String last_name;
private String username;
private PhotoSize[] photo;

public Integer userId() {
public Long userId() {
return user_id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
public class BotUtilsTest {

final String updateStr = "{\"update_id\":874199391,\n" +
"\"message\":{\"message_id\":33111,\"from\":{\"id\":1231231231,\"is_bot\":false,\"first_name\":\"RRRR\",\"username\":\"RRRR54321\"},\"chat\":{\"id\":-23123123123123,\"title\":\"hhh iiiiii ccccc\",\"type\":\"supergroup\"},\"date\":1579958705,\"text\":\"block the news\"}}";
"\"message\":{\"message_id\":33111,\"from\":{\"id\":1231231231,\"is_bot\":false,\"first_name\":\"RRRR\",\"username\":\"RRRR54321\"},\"chat\":{\"id\":-23123123123123,\"title\":\"hhh iiiiii ccccc\",\"type\":\"supergroup\"},\"user_shared\":{\"user_id\":6111111111,\"request_id\":1},\"users_shared\":{\"user_ids\":[6111111111],\"users\":[{\"user_id\":6111111111,\"first_name\":\"FirstNameTest\",\"last_name\":\"LastNameTest\"}],\"request_id\":1},\"date\":1579958705,\"text\":\"block the news\"}}";

private void check(Update update) {
assertEquals(update.updateId(), Integer.valueOf(874199391));
assertEquals(update.message().messageId(), Integer.valueOf(33111));
assertEquals(update.message().usersShared().users()[0].userId(), Long.valueOf(6111111111L));
}

@Test
Expand All @@ -51,5 +52,4 @@ public void parseNull() {
assertNull(BotUtils.fromJson(null, SendResponse.class));
assertNull(BotUtils.fromJson("",SendResponse.class));
}

}

0 comments on commit 920f176

Please sign in to comment.