BAEL-6432 - Asserting Equality on Two Classes without an Equals Method (#14193)

This commit is contained in:
Ana Peterlić
2023-06-15 17:43:10 +02:00
committed by GitHub
parent 89c8cda3f9
commit 4bfa3cb53b
4 changed files with 233 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
package com.baeldung.assertequals;
public class Address {
private Long id;
private String city;
private String street;
private String country;
public Address(final Long id, final String city, final String street, final String country) {
this.id = id;
this.city = city;
this.street = street;
this.country = country;
}
public Long getId() {
return id;
}
public void setId(final Long id) {
this.id = id;
}
public String getCity() {
return city;
}
public void setCity(final String city) {
this.city = city;
}
public String getStreet() {
return street;
}
public void setStreet(final String street) {
this.street = street;
}
public String getCountry() {
return country;
}
public void setCountry(final String country) {
this.country = country;
}
@Override
public String toString() {
return "Address{" +
"id=" + id +
", city='" + city + '\'' +
", street='" + street + '\'' +
", country='" + country + '\'' +
'}';
}
}