org.fest.assertions.internal
Class RealNumbers<NUMBER extends Comparable<NUMBER>>

java.lang.Object
  extended by org.fest.assertions.internal.Comparables
      extended by org.fest.assertions.internal.Numbers<NUMBER>
          extended by org.fest.assertions.internal.RealNumbers<NUMBER>
Direct Known Subclasses:
Doubles, Floats

public abstract class RealNumbers<NUMBER extends Comparable<NUMBER>>
extends Numbers<NUMBER>

Base class of reusable assertions for real numbers (float and double).

Author:
Joel Costigliola

Constructor Summary
RealNumbers()
           
RealNumbers(org.fest.util.ComparisonStrategy comparisonStrategy)
           
 
Method Summary
 void assertIsNaN(AssertionInfo info, NUMBER actual)
          Verifies that the actual value is equal to NaN.
 void assertIsNotNaN(AssertionInfo info, NUMBER actual)
          Verifies that the actual value is not equal to NaN.
protected abstract  boolean isEqualTo(NUMBER actual, NUMBER expected, Offset<?> offset)
          Returns true if the two floats parameter are equal within a positive offset, false otherwise.
protected abstract  NUMBER NaN()
           
 
Methods inherited from class org.fest.assertions.internal.Numbers
assertIsNegative, assertIsNotZero, assertIsPositive, assertIsZero, zero
 
Methods inherited from class org.fest.assertions.internal.Comparables
areEqual, assertEqual, assertEqualByComparison, assertGreaterThan, assertGreaterThanOrEqualTo, assertLessThan, assertLessThanOrEqualTo, assertNotEqual, assertNotEqualByComparison, assertNotNull, getComparator, instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealNumbers

public RealNumbers()

RealNumbers

public RealNumbers(org.fest.util.ComparisonStrategy comparisonStrategy)
Method Detail

assertIsNaN

public void assertIsNaN(AssertionInfo info,
                        NUMBER actual)
Verifies that the actual value is equal to NaN.
It does not rely on the custom comparisonStrategy (if one is set).

Parameters:
info - contains information about the assertion.
actual - the actual value.
Throws:
AssertionError - if the actual value is not equal to NaN.

NaN

protected abstract NUMBER NaN()

assertIsNotNaN

public void assertIsNotNaN(AssertionInfo info,
                           NUMBER actual)
Verifies that the actual value is not equal to NaN.

Parameters:
info - contains information about the assertion.
actual - the actual value.
Throws:
AssertionError - if the actual value is equal to NaN.

isEqualTo

protected abstract boolean isEqualTo(NUMBER actual,
                                     NUMBER expected,
                                     Offset<?> offset)
Returns true if the two floats parameter are equal within a positive offset, false otherwise.
It does not rely on the custom comparisonStrategy (if one is set) because using an offset is already a specific comparison strategy.

Parameters:
actual - the actual value.
expected - the expected value.
offset - the given positive offset.
Returns:
true if the two floats parameter are equal within a positive offset, false otherwise.


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.