Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.github.kristofa.test.http;

The content of a HttpRequest or response can be structured data like JSON / XML.

HttpRequestImpl treats content as a byte array by default. However in the case JSON / XML you can have a non equal byte array which still gives you the same representation: for example different order of properties in json..

To be able to have custom equals/hashcode logic you can set your own ContentMatcher when building a HttpRequestImpl.

Author(s):
kristof
See also:
HttpRequestImpl
public abstract class ContentMatcher {

    
Gets content.

Returns:
Content.
    abstract public byte[] getContent();

    
Sets content.

Parameters:
content Content.
Throws:
UnexpectedContentException In case we don't expect given content. This matcher is incompatible with given content.
    abstract public void setContent(byte[] contentthrows UnexpectedContentException;

    
    @Override
    abstract public boolean equals(Object obj);

    
    @Override
    abstract public int hashCode();

    
Create a copy of this ContentProxy.

Returns:
Copy of this content proxy.
    abstract public ContentMatcher copy();
New to GrepCode? Check out our FAQ X