com.github.kristofa.test.http
Class ContentMatcher

java.lang.Object
  extended by com.github.kristofa.test.http.ContentMatcher

public abstract class ContentMatcher
extends Object

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:
kristof
See Also:
HttpRequestImpl

Constructor Summary
ContentMatcher()
           
 
Method Summary
abstract  ContentMatcher copy()
          Create a copy of this ContentProxy.
abstract  boolean equals(Object obj)
          
abstract  byte[] getContent()
          Gets content.
abstract  int hashCode()
          
abstract  void setContent(byte[] content)
          Sets content.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentMatcher

public ContentMatcher()
Method Detail

getContent

public abstract byte[] getContent()
Gets content.

Returns:
Content.

setContent

public abstract void setContent(byte[] content)
                         throws UnexpectedContentException
Sets content.

Parameters:
content - Content.
Throws:
UnexpectedContentException - In case we don't expect given content. This matcher is incompatible with given content.

equals

public abstract boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public abstract int hashCode()

Overrides:
hashCode in class Object

copy

public abstract ContentMatcher copy()
Create a copy of this ContentProxy.

Returns:
Copy of this content proxy.


Copyright © 2014. All Rights Reserved.