org.test4j.hamcrest.matcher.property.difference
类 MapDifference

java.lang.Object
  继承者 org.test4j.hamcrest.matcher.property.difference.Difference
      继承者 org.test4j.hamcrest.matcher.property.difference.MapDifference

public class MapDifference
extends Difference

A class for holding the difference between two collections or arrays.


构造方法摘要
MapDifference(String message, Object leftValue, Object rightValue, Map<?,?> leftMap, Map<?,?> rightMap)
          Creates a difference.
 
方法摘要
<T,A> T
accept(DifferenceVisitor<T,A> visitor, A argument)
          Double dispatch method.
 void addLeftMissingKey(Object key)
          Adds a key of the left map that is missing in the right map.
 void addRightMissingKey(Object key)
          Adds a key of the right map that is missing in the left map.
 void addValueDifference(Object key, Difference difference)
          Adds a difference for the element at the given key.
 Map<?,?> getLeftMap()
           
 List<Object> getLeftMissingKeys()
          Gets the keys of the left maps that were missing in the right map.
 Map<?,?> getRightMap()
           
 List<Object> getRightMissingKeys()
          Gets the keys of the left maps that were missing in the right map.
 Map<Object,Difference> getValueDifferences()
          Gets all element differences per key.
 
从类 org.test4j.hamcrest.matcher.property.difference.Difference 继承的方法
getLeftValue, getMessage, getRightValue, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

MapDifference

public MapDifference(String message,
                     Object leftValue,
                     Object rightValue,
                     Map<?,?> leftMap,
                     Map<?,?> rightMap)
Creates a difference.

参数:
message - a message describing the difference
leftValue - the left instance
rightValue - the right instance
leftMap - The left instance as a map
rightMap - The right instance as a map
方法详细信息

addValueDifference

public void addValueDifference(Object key,
                               Difference difference)
Adds a difference for the element at the given key.

参数:
key - The key
difference - The difference, not null

getValueDifferences

public Map<Object,Difference> getValueDifferences()
Gets all element differences per key.

返回:
The differences, not null

addLeftMissingKey

public void addLeftMissingKey(Object key)
Adds a key of the left map that is missing in the right map.

参数:
key - The left key

getLeftMissingKeys

public List<Object> getLeftMissingKeys()
Gets the keys of the left maps that were missing in the right map.

返回:
The keys, not null

addRightMissingKey

public void addRightMissingKey(Object key)
Adds a key of the right map that is missing in the left map.

参数:
key - The right key

getRightMissingKeys

public List<Object> getRightMissingKeys()
Gets the keys of the left maps that were missing in the right map.

返回:
The keys, not null

getLeftMap

public Map<?,?> getLeftMap()
返回:
The left instance as a map

getRightMap

public Map<?,?> getRightMap()
返回:
The right instance as a map

accept

public <T,A> T accept(DifferenceVisitor<T,A> visitor,
                      A argument)
Double dispatch method. Dispatches back to the given visitor.

All subclasses should copy this method in their own class body.

覆盖:
Difference 中的 accept
参数:
visitor - The visitor, not null
argument - An optional argument for the visitor, null if not applicable
返回:
The result


Copyright © 2013. All rights reserved.