com.github.restdriver.serverdriver.matchers
Class HasHeaderWithValue

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<Response>
          extended by com.github.restdriver.serverdriver.matchers.HasHeaderWithValue
All Implemented Interfaces:
org.hamcrest.Matcher<Response>, org.hamcrest.SelfDescribing

public final class HasHeaderWithValue
extends org.hamcrest.TypeSafeMatcher<Response>

Matcher to enable assertion on HTTP header values. TODO: Is this class necessary we can do:

assertThat(response.getHeaders(), hasItem(new Header("header", "value")))


Constructor Summary
HasHeaderWithValue(String name, org.hamcrest.Matcher<String> valueMatcher)
          Creates a new instance of this matcher.
 
Method Summary
protected  void describeMismatchSafely(Response response, org.hamcrest.Description mismatchDescription)
           
 void describeTo(org.hamcrest.Description description)
           
protected  boolean matchesSafely(Response response)
           
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HasHeaderWithValue

public HasHeaderWithValue(String name,
                          org.hamcrest.Matcher<String> valueMatcher)
Creates a new instance of this matcher.

Parameters:
name - The name of the header to evaluate
valueMatcher - The matcher to use against the header value if a header with the specified name is found
Method Detail

matchesSafely

protected boolean matchesSafely(Response response)
Specified by:
matchesSafely in class org.hamcrest.TypeSafeMatcher<Response>

describeTo

public void describeTo(org.hamcrest.Description description)

describeMismatchSafely

protected void describeMismatchSafely(Response response,
                                      org.hamcrest.Description mismatchDescription)
Overrides:
describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<Response>


Copyright © 2011. All Rights Reserved.