org.assertj.core.internal
Class AbstractComparisonStrategy

java.lang.Object
  extended by org.assertj.core.internal.AbstractComparisonStrategy
All Implemented Interfaces:
ComparisonStrategy
Direct Known Subclasses:
ComparatorBasedComparisonStrategy, StandardComparisonStrategy

public abstract class AbstractComparisonStrategy
extends Object
implements ComparisonStrategy

Base implementation of ComparisonStrategy contract.

Author:
Joel Costigliola

Constructor Summary
AbstractComparisonStrategy()
           
 
Method Summary
 boolean arrayContains(Object array, Object value)
          Returns true if given array contains given value according to the implemented comparison strategy, false otherwise.
abstract  String asText()
           
 Iterable<?> duplicatesFrom(Iterable<?> iterable)
          Returns any duplicate elements from the given Iterable according to the implemented comparison strategy.
 boolean isGreaterThanOrEqualTo(Object actual, Object other)
          Returns true if actual is greater than or equal to other, false otherwise.
 boolean isLessThan(Object actual, Object other)
          Returns true if actual is less than other, false otherwise.
 boolean isLessThanOrEqualTo(Object actual, Object other)
          Returns true if actual is less than or equal to other, false otherwise.
 boolean isStandard()
          Return true if comparison strategy is default/standard, false otherwise
protected abstract  Set<Object> newSetUsingComparisonStrategy()
          Returns a Set honoring the comparison strategy used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.assertj.core.internal.ComparisonStrategy
areEqual, isGreaterThan, iterableContains, iterableRemoves, stringContains, stringEndsWith, stringStartsWith
 

Constructor Detail

AbstractComparisonStrategy

public AbstractComparisonStrategy()
Method Detail

duplicatesFrom

public Iterable<?> duplicatesFrom(Iterable<?> iterable)
Description copied from interface: ComparisonStrategy
Returns any duplicate elements from the given Iterable according to the implemented comparison strategy.

Specified by:
duplicatesFrom in interface ComparisonStrategy
Parameters:
iterable - the given Iterable we want to extract duplicate elements.
Returns:
an Iterable containing the duplicate elements of the given one. If no duplicates are found, an empty Iterable is returned.

newSetUsingComparisonStrategy

protected abstract Set<Object> newSetUsingComparisonStrategy()
Returns a Set honoring the comparison strategy used.

Returns:
a Set honoring the comparison strategy used.

arrayContains

public boolean arrayContains(Object array,
                             Object value)
Description copied from interface: ComparisonStrategy
Returns true if given array contains given value according to the implemented comparison strategy, false otherwise.

Specified by:
arrayContains in interface ComparisonStrategy
Parameters:
array - the array to search value in (must not be null)
value - the object to look for in given array
Returns:
true if given array contains given value according to the implemented comparison strategy, false otherwise.

isLessThan

public boolean isLessThan(Object actual,
                          Object other)
Description copied from interface: ComparisonStrategy
Returns true if actual is less than other, false otherwise.

Specified by:
isLessThan in interface ComparisonStrategy
Parameters:
actual - the object to compare to other
other - the object to compare to actual
Returns:
true if actual is less than other, false otherwise.

isLessThanOrEqualTo

public boolean isLessThanOrEqualTo(Object actual,
                                   Object other)
Description copied from interface: ComparisonStrategy
Returns true if actual is less than or equal to other, false otherwise.

Specified by:
isLessThanOrEqualTo in interface ComparisonStrategy
Parameters:
actual - the object to compare to other
other - the object to compare to actual
Returns:
true if actual is less than or equal to other, false otherwise.

isGreaterThanOrEqualTo

public boolean isGreaterThanOrEqualTo(Object actual,
                                      Object other)
Description copied from interface: ComparisonStrategy
Returns true if actual is greater than or equal to other, false otherwise.

Specified by:
isGreaterThanOrEqualTo in interface ComparisonStrategy
Parameters:
actual - the object to compare to other
other - the object to compare to actual
Returns:
true if actual is greater than or equal to other, false otherwise.

asText

public abstract String asText()

isStandard

public boolean isStandard()
Description copied from interface: ComparisonStrategy
Return true if comparison strategy is default/standard, false otherwise

Specified by:
isStandard in interface ComparisonStrategy
Returns:
true if comparison strategy is default/standard, false otherwise


Copyright © 2013–2015 AssertJ. All rights reserved.