org.testinfected.hamcrest.spring
Class SpringMatchers

java.lang.Object
  extended by org.testinfected.hamcrest.spring.SpringMatchers

public class SpringMatchers
extends java.lang.Object


Method Summary
static org.hamcrest.Matcher<org.springframework.ui.Model> containsAttribute(java.lang.String key)
          Checks that a web Model contains some non-null value stored under a specific key.
static
<T> org.hamcrest.Matcher<org.springframework.ui.Model>
hasAttribute(java.lang.String key, T value)
          Checks that a web Model contains a given key-value pair.
static
<T> org.hamcrest.Matcher<org.springframework.ui.Model>
hasAttributeValue(java.lang.String key, org.hamcrest.Matcher<? super T> valueMatcher)
          Checks that a web Model contains a given key-value pair.
static org.hamcrest.Matcher<java.lang.String> isRedirectedTo(java.lang.String location)
          Checks that a view indicates an HTTP redirection to a given location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasAttribute

public static <T> org.hamcrest.Matcher<org.springframework.ui.Model> hasAttribute(java.lang.String key,
                                                                                  T value)
Checks that a web Model contains a given key-value pair.

Parameters:
key - the key under which the value to check is stored in the model.
value - the expected value stored in the model.

hasAttributeValue

public static <T> org.hamcrest.Matcher<org.springframework.ui.Model> hasAttributeValue(java.lang.String key,
                                                                                       org.hamcrest.Matcher<? super T> valueMatcher)
Checks that a web Model contains a given key-value pair. The key value must match the given matcher.

Parameters:
key - the key under which the value to check is stored in the model.
valueMatcher - matcher used to check the value stored in the model.

containsAttribute

public static org.hamcrest.Matcher<org.springframework.ui.Model> containsAttribute(java.lang.String key)
Checks that a web Model contains some non-null value stored under a specific key.

Parameters:
key - the key under which a non-null value should be stored in the model.

isRedirectedTo

public static org.hamcrest.Matcher<java.lang.String> isRedirectedTo(java.lang.String location)
Checks that a view indicates an HTTP redirection to a given location.

Parameters:
location - expected location of the redirection.


Copyright © 2012. All Rights Reserved.