org.test4j.hamcrest.iassert.common.impl
类 ReflectionAssert<T,E extends IAssert>

java.lang.Object
  继承者 ext.test4j.hamcrest.BaseMatcher<T>
      继承者 org.test4j.hamcrest.iassert.common.impl.Assert<T,E>
          继承者 org.test4j.hamcrest.iassert.common.impl.BaseAssert<T,E>
              继承者 org.test4j.hamcrest.iassert.common.impl.ListHasItemsAssert<T,E>
                  继承者 org.test4j.hamcrest.iassert.common.impl.ReflectionAssert<T,E>
所有已实现的接口:
Matcher<T>, SelfDescribing, IAssert<T,E>, IBaseAssert<T,E>, IListHasItemsAssert<E>, IReflectionAssert<E>
直接已知子类:
ObjectAssert, SizeAssert

public class ReflectionAssert<T,E extends IAssert>
extends ListHasItemsAssert<T,E>
implements IReflectionAssert<E>


嵌套类摘要
 
从类 org.test4j.hamcrest.iassert.common.impl.Assert 继承的嵌套类/接口
Assert.AssertType
 
字段摘要
 
从类 org.test4j.hamcrest.iassert.common.impl.Assert 继承的字段
assertClaz, link, the, type, value, valueClaz
 
构造方法摘要
ReflectionAssert(Class<? extends IAssert> clazE)
           
ReflectionAssert(T value, Class<? extends IAssert> clazE)
           
 
方法摘要
 E eqByReflect(Object expected, EqMode... modes)
          通过反射比较实际值和期望值的属性时,二者的属性是相同的
属性如果是复杂对象,递归反射比较
 E eqIgnoreAll(Object expected)
          在忽略顺序,默认值,日期的情况下二者是相等的
 E eqIgnoreDefault(Object expected)
          在忽略期望值是null或默认值的情况下二者是相等的
 E eqIgnoreOrder(Object expected)
          在忽略元素顺序情况下二者是相等的
 E propertyEq(String[] properties, Object expected, EqMode... modes)
          断言对象的多个属性相等
same as "eqByProperties(String[],Object)"
 E propertyEq(String property, Object expected, EqMode... modes)
          断言对象指定的属性(property)值等于期望值
same as "eqByProperty(String, Object)"
 E propertyEq(String property, String expected, StringMode mode, StringMode... more)
          断言对象指定的属性(property)值等于期望值字符串
 E propertyEqMap(ICore.DataMap expected, EqMode... modes)
          把实际对象按照Map中的key值取出来,进行反射比较
如果对象的属性不在Map中,则不进行比较
功能和 "propertyEq(String[] properties, Object expected, EqMode... modes)"类似, 无非这里是把属性写到了Map中,方便一一对应
 E propertyMatch(String property, Matcher matcher)
          对象的属性值符合指定的断言器要求
 E reflectionEq(Object expected, EqMode... modes)
          Same as eqByReflect, will be @Deprecated in the future.
 E reflectionEqMap(ICore.DataMap expected, EqMode... modes)
          Same as propertyEqMap, will be @deprecated in the future.
 
从类 org.test4j.hamcrest.iassert.common.impl.ListHasItemsAssert 继承的方法
allItemsMatchAll, allItemsMatchAny, anyItemsMatchAll, anyItemsMatchAny, hasAllItems, hasAnyItems, hasItems, hasItems, match
 
从类 org.test4j.hamcrest.iassert.common.impl.BaseAssert 继承的方法
all, any, any, clazIs, clazIsSubFrom, eq, eqToString, eqToString, in, isEqualTo, isEqualTo, isNull, isNull, not, notAll, notAny, notEqualTo, notIn, notNull, notNull, same, toStringAssert
 
从类 org.test4j.hamcrest.iassert.common.impl.Assert 继承的方法
assertThat, assertThat, describeTo, equals, getValueClaz, hashCode, matches, toString, wanted, wanted
 
从类 ext.test4j.hamcrest.BaseMatcher 继承的方法
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
从接口 org.test4j.hamcrest.iassert.common.intf.IAssert 继承的方法
wanted, wanted
 
从接口 ext.test4j.hamcrest.Matcher 继承的方法
describeMismatch, matches
 
从接口 ext.test4j.hamcrest.SelfDescribing 继承的方法
describeTo
 

构造方法详细信息

ReflectionAssert

public ReflectionAssert(Class<? extends IAssert> clazE)

ReflectionAssert

public ReflectionAssert(T value,
                        Class<? extends IAssert> clazE)
方法详细信息

propertyEq

public E propertyEq(String[] properties,
                    Object expected,
                    EqMode... modes)
从接口 IReflectionAssert 复制的描述
断言对象的多个属性相等
same as "eqByProperties(String[],Object)"

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 propertyEq
返回:

reflectionEq

public E reflectionEq(Object expected,
                      EqMode... modes)
从接口 IReflectionAssert 复制的描述
Same as eqByReflect, will be @Deprecated in the future.

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 reflectionEq

eqByReflect

public E eqByReflect(Object expected,
                     EqMode... modes)
从接口 IReflectionAssert 复制的描述
通过反射比较实际值和期望值的属性时,二者的属性是相同的
属性如果是复杂对象,递归反射比较

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 eqByReflect
参数:
expected - 期望对象
modes - 比较模式,详见org.test4j.hamcrest.matcher.property.reflection.EqMode
返回:

propertyMatch

public E propertyMatch(String property,
                       Matcher matcher)
从接口 IReflectionAssert 复制的描述
对象的属性值符合指定的断言器要求

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 propertyMatch
返回:

propertyEq

public E propertyEq(String property,
                    Object expected,
                    EqMode... modes)
从接口 IReflectionAssert 复制的描述
断言对象指定的属性(property)值等于期望值
same as "eqByProperty(String, Object)"

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 propertyEq
参数:
property - 对象属性名称
expected - 期望值
返回:

propertyEq

public E propertyEq(String property,
                    String expected,
                    StringMode mode,
                    StringMode... more)
从接口 IReflectionAssert 复制的描述
断言对象指定的属性(property)值等于期望值字符串

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 propertyEq
返回:

eqIgnoreDefault

public E eqIgnoreDefault(Object expected)
从接口 IReflectionAssert 复制的描述
在忽略期望值是null或默认值的情况下二者是相等的

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 eqIgnoreDefault
返回:

eqIgnoreOrder

public E eqIgnoreOrder(Object expected)
从接口 IReflectionAssert 复制的描述
在忽略元素顺序情况下二者是相等的

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 eqIgnoreOrder
返回:

eqIgnoreAll

public E eqIgnoreAll(Object expected)
从接口 IReflectionAssert 复制的描述
在忽略顺序,默认值,日期的情况下二者是相等的

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 eqIgnoreAll
返回:

reflectionEqMap

public E reflectionEqMap(ICore.DataMap expected,
                         EqMode... modes)
从接口 IReflectionAssert 复制的描述
Same as propertyEqMap, will be @deprecated in the future.

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 reflectionEqMap
返回:

propertyEqMap

public E propertyEqMap(ICore.DataMap expected,
                       EqMode... modes)
从接口 IReflectionAssert 复制的描述
把实际对象按照Map中的key值取出来,进行反射比较
如果对象的属性不在Map中,则不进行比较
功能和 "propertyEq(String[] properties, Object expected, EqMode... modes)"类似, 无非这里是把属性写到了Map中,方便一一对应

指定者:
接口 IReflectionAssert<E extends IAssert> 中的 propertyEqMap
返回:


Copyright © 2013. All rights reserved.