org.sonatype.sisu.litmus.testsupport.hamcrest
Class BeanMatchers.SimilarMatcher<T>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.sonatype.sisu.litmus.testsupport.hamcrest.BeanMatchers.SimilarMatcher<T>
Type Parameters:
T - expected type
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing
Enclosing class:
BeanMatchers

public static class BeanMatchers.SimilarMatcher<T>
extends org.hamcrest.BaseMatcher<T>

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.

Since:
1.0

Field Summary
 Object failingActual
          Value that actually failed.
 
Constructor Summary
BeanMatchers.SimilarMatcher(T expected)
          Constructor.
 
Method Summary
 void describeMismatch(Object actual, org.hamcrest.Description description)
          
 void describeTo(org.hamcrest.Description description)
          
 boolean matches(Object actual)
          
 String toString()
          
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

failingActual

public Object failingActual
Value that actually failed.

Constructor Detail

BeanMatchers.SimilarMatcher

public BeanMatchers.SimilarMatcher(T expected)
Constructor.

Parameters:
expected - expected value. Can be null.
Since:
1.0
Method Detail

matches

public boolean matches(Object actual)


describeTo

public void describeTo(org.hamcrest.Description description)


describeMismatch

public void describeMismatch(Object actual,
                             org.hamcrest.Description description)

Specified by:
describeMismatch in interface org.hamcrest.Matcher<T>
Overrides:
describeMismatch in class org.hamcrest.BaseMatcher<T>

toString

public String toString()

Overrides:
toString in class org.hamcrest.BaseMatcher<T>


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