org.sonatype.sisu.litmus.testsupport.hamcrest
Class BeanMatchers

java.lang.Object
  extended by org.sonatype.sisu.litmus.testsupport.hamcrest.BeanMatchers

public class BeanMatchers
extends Object

Java beans related matchers.

Since:
1.0

Nested Class Summary
static class BeanMatchers.SimilarMatcher<T>
          Are the two java beans similar?.
 
Constructor Summary
BeanMatchers()
           
 
Method Summary
static
<T> org.hamcrest.Matcher<T>
similarTo(T expected)
          Are the two java beans similar?.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanMatchers

public BeanMatchers()
Method Detail

similarTo

public static <T> org.hamcrest.Matcher<T> similarTo(T expected)
Are the two java beans similar?. The matching is done by doing a deep equals of all getters present in actual and expected bean. If bean contains array/collections/iterables/iterator getters it will apply similarity check on elements of those.

Type Parameters:
T - expected type
Parameters:
expected - expected value to be matched
Returns:
true if beans are similar


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.