Skip to content

Commit

Permalink
[SI-13868] Add ActionResult object semantic equality
Browse files Browse the repository at this point in the history
This is needed for comparing two ActionResults by their value and
HTTPStatus code. Since their is no superclass, by default it otherwise
just compares object references rather than values which is not
helpful for equality checking.

container wc-test: https://crt.prod.linkedin.com/#/testing/executions/809c56ca-bb8b-4667-a5c8-c58021f7db87/execution

RB=1882082
G=si-dev
R=evwillia,jguan,dragade,tni,bpalmer
A=ssheng
  • Loading branch information
RONNCC committed Nov 26, 2019
1 parent 454e917 commit ed1db88
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
28.0.8
------
(RB=1882082)
Adds equality/hash methods for ActionResult class


28.0.7
------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


import com.linkedin.restli.common.HttpStatus;
import java.util.Objects;


/**
Expand Down Expand Up @@ -55,4 +56,25 @@ public HttpStatus getStatus()
{
return _status;
}

@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
ActionResult<?> that = (ActionResult<?>) o;
return Objects.equals(_value, that._value) && _status == that._status;
}

@Override
public int hashCode()
{
return Objects.hash(_value, _status);
}
}

0 comments on commit ed1db88

Please sign in to comment.