Skip to content

Commit

Permalink
Test more model classes
Browse files Browse the repository at this point in the history
  • Loading branch information
pengrad committed Aug 21, 2024
1 parent cdfd85c commit 0832bf1
Show file tree
Hide file tree
Showing 24 changed files with 288 additions and 298 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,25 @@ public Boolean isEnabled() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessConnection)) return false;
if (o == null || getClass() != o.getClass()) return false;
BusinessConnection that = (BusinessConnection) o;
return Objects.equals(id, that.id)
&& Objects.equals(user, that.user)
&& Objects.equals(user_chat_id, that.user_chat_id)
&& Objects.equals(date, that.date)
&& Objects.equals(can_reply, that.can_reply)
&& Objects.equals(is_enabled, that.is_enabled);
return Objects.equals(id, that.id) && Objects.equals(user, that.user) && Objects.equals(user_chat_id, that.user_chat_id) && Objects.equals(date, that.date) && Objects.equals(can_reply, that.can_reply) && Objects.equals(is_enabled, that.is_enabled);
}

@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
return Objects.hash(id, user, user_chat_id, date, can_reply, is_enabled);
}

@Override
public String toString() {
return "BusinessConnection{" +
"id='" + id + '\'' +
", user=" + user +
", user_chat_id=" + user_chat_id +
", date=" + date +
", can_reply=" + can_reply +
", is_enabled=" + is_enabled +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ public Sticker sticker() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessIntro)) return false;
if (o == null || getClass() != o.getClass()) return false;
BusinessIntro that = (BusinessIntro) o;
return Objects.equals(title, that.title)
&& Objects.equals(message, that.message)
&& Objects.equals(sticker, that.sticker);
return Objects.equals(title, that.title) && Objects.equals(message, that.message) && Objects.equals(sticker, that.sticker);
}

@Override
Expand All @@ -40,9 +38,9 @@ public int hashCode() {
@Override
public String toString() {
return "BusinessIntro{" +
"title='" + title + '\'' +
", message='" + message + '\'' +
", sticker=" + sticker +
'}';
"title='" + title + '\'' +
", message='" + message + '\'' +
", sticker=" + sticker +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Location location() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessLocation)) return false;
if (o == null || getClass() != o.getClass()) return false;
BusinessLocation that = (BusinessLocation) o;
return Objects.equals(address, that.address) && Objects.equals(location, that.location);
}
Expand All @@ -33,8 +33,8 @@ public int hashCode() {
@Override
public String toString() {
return "BusinessLocation{" +
"address='" + address + '\'' +
", location=" + location +
'}';
"address='" + address + '\'' +
", location=" + location +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,22 @@ public Integer[] messageIds() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessMessageDeleted)) return false;
if (o == null || getClass() != o.getClass()) return false;
BusinessMessageDeleted that = (BusinessMessageDeleted) o;
return Objects.equals(business_connection_id, that.business_connection_id)
&& Objects.equals(chat, that.chat)
&& Arrays.equals(message_ids, that.message_ids);
return Objects.equals(business_connection_id, that.business_connection_id) && Objects.equals(chat, that.chat) && Objects.deepEquals(message_ids, that.message_ids);
}

@Override
public int hashCode() {
int result = Objects.hash(business_connection_id, chat);
result = 31 * result + Arrays.hashCode(message_ids);
return result;
return Objects.hash(business_connection_id, chat, Arrays.hashCode(message_ids));
}

@Override
public String toString() {
return "BusinessMessageDeleted{" +
"business_connection_id='" + business_connection_id + '\'' +
", chat=" + chat +
", message_ids=" + Arrays.toString(message_ids) +
'}';
"business_connection_id='" + business_connection_id + '\'' +
", chat=" + chat +
", message_ids=" + Arrays.toString(message_ids) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,21 @@ public BusinessOpeningHoursInterval[] openingHours() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessOpeningHours)) return false;
if (o == null || getClass() != o.getClass()) return false;
BusinessOpeningHours that = (BusinessOpeningHours) o;
return Objects.equals(time_zone_name, that.time_zone_name) && Arrays.equals(opening_hours, that.opening_hours);
return Objects.equals(time_zone_name, that.time_zone_name) && Objects.deepEquals(opening_hours, that.opening_hours);
}

@Override
public int hashCode() {
int result = Objects.hash(time_zone_name);
result = 31 * result + Arrays.hashCode(opening_hours);
return result;
return Objects.hash(time_zone_name, Arrays.hashCode(opening_hours));
}

@Override
public String toString() {
return "BusinessOpeningHours{" +
"time_zone_name='" + time_zone_name + '\'' +
", opening_hours=" + Arrays.toString(opening_hours) +
'}';
"time_zone_name='" + time_zone_name + '\'' +
", opening_hours=" + Arrays.toString(opening_hours) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ public Integer closing_minute() {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessOpeningHoursInterval)) return false;
if (o == null || getClass() != o.getClass()) return false;
BusinessOpeningHoursInterval that = (BusinessOpeningHoursInterval) o;
return Objects.equals(opening_minute, that.opening_minute)
&& Objects.equals(closing_minute, that.closing_minute);
return Objects.equals(opening_minute, that.opening_minute) && Objects.equals(closing_minute, that.closing_minute);
}

@Override
Expand All @@ -32,8 +31,8 @@ public int hashCode() {
@Override
public String toString() {
return "BusinessOpeningHoursInterval{" +
"opening_minute=" + opening_minute +
", closing_minute=" + closing_minute +
'}';
"opening_minute=" + opening_minute +
", closing_minute=" + closing_minute +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pengrad.telegrambot.model.chatbackground;

import java.util.Arrays;
import java.util.Objects;

public class BackgroundFillFreeformGradient extends BackgroundFill {

Expand All @@ -21,20 +22,20 @@ public Integer[] colors() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundFillFreeformGradient that = (BackgroundFillFreeformGradient) o;
return Arrays.equals(colors, that.colors);
return Objects.deepEquals(colors, that.colors);
}

@Override
public int hashCode() {
return Arrays.hashCode(colors);
return Objects.hash(super.hashCode(), Arrays.hashCode(colors));
}

@Override
public String toString() {
return "BackgroundFillFreeformGradient{" +
"type='" + type() + '\'' +
", colors=" + Arrays.asList(colors) +
'}';
"colors=" + Arrays.toString(colors) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,23 @@ public Integer rotationAngle() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundFillGradient that = (BackgroundFillGradient) o;
return Objects.equals(top_color, that.top_color) && Objects.equals(bottom_color, that.bottom_color) && Objects.equals(rotation_angle, that.rotation_angle);
}

@Override
public int hashCode() {
return Objects.hash(top_color, bottom_color, rotation_angle);
return Objects.hash(super.hashCode(), top_color, bottom_color, rotation_angle);
}

@Override
public String toString() {
return "BackgroundFillGradient{" +
"type='" + type() + '\'' +
", top_color=" + top_color +
", bottom_color=" + bottom_color +
", rotation_angle=" + rotation_angle +
'}';
"type='" + type() + '\'' +
", top_color=" + top_color +
", bottom_color=" + bottom_color +
", rotation_angle=" + rotation_angle +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ public Integer color() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundFillSolid that = (BackgroundFillSolid) o;
return Objects.equals(color, that.color);
}

@Override
public int hashCode() {
return Objects.hash(color);
return Objects.hash(super.hashCode(), color);
}

@Override
public String toString() {
return "BackgroundFillSolid{" +
"type='" + type() + '\'' +
", color=" + color +
'}';
"type='" + type() + '\'' +
", color=" + color +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ public String themeName() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundTypeChatTheme that = (BackgroundTypeChatTheme) o;
return Objects.equals(theme_name, that.theme_name);
}

@Override
public int hashCode() {
return Objects.hash(theme_name);
return Objects.hash(super.hashCode(), theme_name);
}

@Override
public String toString() {
return "BackgroundTypeChatTheme{" +
"type='" + type() + '\'' +
", theme_name=" + theme_name +
'}';
"type='" + type() + '\'' +
", theme_name=" + theme_name +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ public Integer darkThemeDimming() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundTypeFill that = (BackgroundTypeFill) o;
return Objects.equals(fill, that.fill) &&
Objects.equals(dark_theme_dimming, that.dark_theme_dimming);
return Objects.equals(fill, that.fill) && Objects.equals(dark_theme_dimming, that.dark_theme_dimming);
}

@Override
public int hashCode() {
return Objects.hash(fill, dark_theme_dimming);
return Objects.hash(super.hashCode(), fill, dark_theme_dimming);
}

@Override
public String toString() {
return "BackgroundTypeFill{" +
"type='" + type() + '\'' +
", fill='" + fill + '\'' +
", dark_theme_dimming=" + dark_theme_dimming +
'}';
"type='" + type() + '\'' +
", fill='" + fill + '\'' +
", dark_theme_dimming=" + dark_theme_dimming +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,24 @@ public BackgroundTypePattern isMoving(Boolean isMoving) {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundTypePattern that = (BackgroundTypePattern) o;
return Objects.equals(document, that.document) &&
Objects.equals(fill, that.fill) &&
Objects.equals(intensity, that.intensity) &&
Objects.equals(is_inverted, that.is_inverted) &&
Objects.equals(is_moving, that.is_moving);
return Objects.equals(document, that.document) && Objects.equals(fill, that.fill) && Objects.equals(intensity, that.intensity) && Objects.equals(is_inverted, that.is_inverted) && Objects.equals(is_moving, that.is_moving);
}

@Override
public int hashCode() {
return Objects.hash(document, fill, intensity, is_inverted, is_moving);
return Objects.hash(super.hashCode(), document, fill, intensity, is_inverted, is_moving);
}

@Override
public String toString() {
return "BackgroundTypePattern{" +
"type='" + type() + '\'' +
", document='" + document + '\'' +
", fill=" + fill +
", intensity=" + intensity +
", is_inverted=" + is_inverted +
", is_moving=" + is_moving +
'}';
"document=" + document +
", fill=" + fill +
", intensity=" + intensity +
", is_inverted=" + is_inverted +
", is_moving=" + is_moving +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,24 @@ public BackgroundTypeWallpaper isMoving(Boolean isMoving) {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BackgroundTypeWallpaper that = (BackgroundTypeWallpaper) o;
return Objects.equals(document, that.document) &&
Objects.equals(dark_theme_dimming, that.dark_theme_dimming) &&
Objects.equals(is_blurred, that.is_blurred) &&
Objects.equals(is_moving, that.is_moving);
return Objects.equals(document, that.document) && Objects.equals(dark_theme_dimming, that.dark_theme_dimming) && Objects.equals(is_blurred, that.is_blurred) && Objects.equals(is_moving, that.is_moving);
}

@Override
public int hashCode() {
return Objects.hash(document, dark_theme_dimming, is_blurred, is_moving);
return Objects.hash(super.hashCode(), document, dark_theme_dimming, is_blurred, is_moving);
}

@Override
public String toString() {
return "BackgroundTypeWallpaper{" +
"type='" + type() + '\'' +
", document='" + document + '\'' +
", dark_theme_dimming=" + dark_theme_dimming +
", is_blurred=" + is_blurred +
", is_moving=" + is_moving +
'}';
"type='" + type() + '\'' +
", document='" + document + '\'' +
", dark_theme_dimming=" + dark_theme_dimming +
", is_blurred=" + is_blurred +
", is_moving=" + is_moving +
'}';
}
}
Loading

0 comments on commit 0832bf1

Please sign in to comment.