Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement equals & hashCode in Link class #499

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions allure-model/src/main/java/io/qameta/allure/model/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.qameta.allure.model;

import java.io.Serializable;
import java.util.Objects;

/**
* POJO that stores link information.
Expand Down Expand Up @@ -116,4 +117,22 @@ public Link withUrl(final String value) {
public Link withType(final String value) {
return setType(value);
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Link link = (Link) o;
return Objects.equals(getName(), link.getName()) && Objects.equals(getUrl(), link.getUrl()) && Objects.equals(
getType(), link.getType());
}

@Override
public int hashCode() {
return Objects.hash(getName(), getUrl(), getType());
}
}