Response.Status enum doesn't implement equals in a commutative way.
It would expect:
builtResponse.getStatusInfo().equals(Response.Status.UNAUTHORIZED)
to be equals to
Response.Status.UNAUTHORIZED.equals(builtResponse.getStatusInfo())
But the enumeration doesn't implement equals for StatusType, just relying on object identity. So if builtResponse.getStatusInfo() returns an instance of Statuses.StatusImpl then it will return false even if all the relevant values are the same.
I think the problem here is that objects like Response.Status.UNAUTHORIZED are Status enums and the values returned from response.getStatusInfo() are StatusType interfaces.
Java won't allow an enum to override the equals method, so the toEnum() method was added to the StatusType interface in 2.1. So, while it's not the most intuitive, I think this ought to work:
builtResponse.getStatusInfo().toEnum().equals(Response.Status.UNAUTHORIZED)
is equal to:
Response.Status.UNAUTHORIZED.equals(builtResponse.getStatusInfo().toEnum())
which should also be equals to:
Response.Status.UNAUTHORIZED == builtResponse.getStatusInfo()
Hope this helps!