org.hamcrest.collection
Class IsArrayWithSize<E>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
          extended by org.hamcrest.FeatureMatcher<E[],java.lang.Integer>
              extended by org.hamcrest.collection.IsArrayWithSize<E>
All Implemented Interfaces:
org.hamcrest.Matcher<E[]>, org.hamcrest.SelfDescribing

public class IsArrayWithSize<E>
extends org.hamcrest.FeatureMatcher<E[],java.lang.Integer>

Matches if array size satisfies a nested matcher.


Constructor Summary
IsArrayWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher)
           
 
Method Summary
static
<E> org.hamcrest.Matcher<E[]>
arrayWithSize(int size)
          This is a shortcut to the frequently used arrayWithSize(equalTo(x)).
static
<E> org.hamcrest.Matcher<E[]>
arrayWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher)
          Does array size satisfy a given matcher?
static
<E> org.hamcrest.Matcher<E[]>
emptyArray()
          Matches an empty array.
protected  java.lang.Integer featureValueOf(E[] actual)
           
 
Methods inherited from class org.hamcrest.FeatureMatcher
describeTo, matchesSafely
 
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
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

IsArrayWithSize

public IsArrayWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher)
Method Detail

featureValueOf

protected java.lang.Integer featureValueOf(E[] actual)
Specified by:
featureValueOf in class org.hamcrest.FeatureMatcher<E[],java.lang.Integer>

arrayWithSize

public static <E> org.hamcrest.Matcher<E[]> arrayWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher)
Does array size satisfy a given matcher?


arrayWithSize

public static <E> org.hamcrest.Matcher<E[]> arrayWithSize(int size)
This is a shortcut to the frequently used arrayWithSize(equalTo(x)). For example, assertThat(arrayWithSize(equal_to(x))) vs. assertThat(arrayWithSize(x))


emptyArray

public static <E> org.hamcrest.Matcher<E[]> emptyArray()
Matches an empty array.



Copyright © 2010. All Rights Reserved.