org.fest.assertions
Class DoubleAssert

java.lang.Object
  extended by org.fest.assertions.Assert
      extended by org.fest.assertions.GenericAssert<DoubleAssert,Double>
          extended by org.fest.assertions.DoubleAssert
All Implemented Interfaces:
NumberAssert

public class DoubleAssert
extends GenericAssert<DoubleAssert,Double>
implements NumberAssert

Assertions for Doubles and doubles.

To create a new instance of this class invoke Assertions.assertThat(Double) or Assertions.assertThat(double).

Author:
Yvonne Wang, David DIDIER, Alex Ruiz, Ansgar Konermann

Nested Class Summary
static class DoubleAssert.Delta
          Deprecated. use top-level class Delta instead. This class will be removed in version 2.0.
 
Field Summary
 
Fields inherited from class org.fest.assertions.GenericAssert
actual, myself
 
Constructor Summary
protected DoubleAssert(double actual)
          Creates a new DoubleAssert.
protected DoubleAssert(Double actual)
          Creates a new DoubleAssert.
 
Method Summary
static DoubleAssert.Delta delta(double d)
          Deprecated. use method Delta.delta(double) instead. This method will be removed in version 2.0.
 DoubleAssert isEqualTo(double expected)
          Verifies that the actual Double is equal to the given one.
 DoubleAssert isEqualTo(double expected, Delta delta)
          Verifies that the actual Double is equal to the given one, within a positive delta.
 DoubleAssert isEqualTo(Double expected, Delta delta)
          Verifies that the actual Double is equal to the given one, within a positive delta.
 DoubleAssert isEqualTo(double expected, DoubleAssert.Delta delta)
          Deprecated. use method isEqualTo(double, org.fest.assertions.Delta) instead. This method will be removed in version 2.0.
 DoubleAssert isGreaterThan(double other)
          Verifies that the actual Double is greater than the given one.
 DoubleAssert isGreaterThanOrEqualTo(double other)
          Verifies that the actual Double is greater or equal to the given one.
 DoubleAssert isLessThan(double other)
          Verifies that the actual Double is less than the given one.
 DoubleAssert isLessThanOrEqualTo(double other)
          Verifies that the actual Double is less or equal to the given one.
 DoubleAssert isNaN()
          Verifies that the actual Double is equal to Double.NaN.
 DoubleAssert isNegative()
          Verifies that the actual Double is negative.
 DoubleAssert isNotEqualTo(double other)
          Verifies that the actual Double is not equal to the given one.
 DoubleAssert isPositive()
          Verifies that the actual Double is positive.
 DoubleAssert isZero()
          Verifies that the actual Double is equal to zero.
 
Methods inherited from class org.fest.assertions.GenericAssert
as, as, describedAs, describedAs, doesNotSatisfy, is, isEqualTo, isIn, isIn, isNot, isNotEqualTo, isNotIn, isNotIn, isNotNull, isNotSameAs, isNull, isSameAs, overridingErrorMessage, satisfies
 
Methods inherited from class org.fest.assertions.Assert
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleAssert

protected DoubleAssert(double actual)
Creates a new DoubleAssert.

Parameters:
actual - the actual value to verify.

DoubleAssert

protected DoubleAssert(Double actual)
Creates a new DoubleAssert.

Parameters:
actual - the actual value to verify.
Method Detail

isEqualTo

public DoubleAssert isEqualTo(double expected)
Verifies that the actual Double is equal to the given one.

Parameters:
expected - the value to compare the actual one to.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not equal to the given one.

isEqualTo

@Deprecated
public DoubleAssert isEqualTo(double expected,
                                         DoubleAssert.Delta delta)
Deprecated. use method isEqualTo(double, org.fest.assertions.Delta) instead. This method will be removed in version 2.0.

Verifies that the actual Double is equal to the given one, within a positive delta.

Parameters:
expected - the value to compare the actual one to.
delta - the given delta.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not equal to the given one.

isEqualTo

public DoubleAssert isEqualTo(double expected,
                              Delta delta)
Verifies that the actual Double is equal to the given one, within a positive delta.

Parameters:
expected - the value to compare the actual one to.
delta - the given delta.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not equal to the given one.
Since:
1.1

isEqualTo

public DoubleAssert isEqualTo(Double expected,
                              Delta delta)
Verifies that the actual Double is equal to the given one, within a positive delta.

Parameters:
expected - the value to compare the actual one to.
delta - the given delta.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not equal to the given one.
Since:
1.3

isNotEqualTo

public DoubleAssert isNotEqualTo(double other)
Verifies that the actual Double is not equal to the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is equal to the given one.

isGreaterThan

public DoubleAssert isGreaterThan(double other)
Verifies that the actual Double is greater than the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not greater than the given one.

isLessThan

public DoubleAssert isLessThan(double other)
Verifies that the actual Double is less than the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not less than the given one.

isGreaterThanOrEqualTo

public DoubleAssert isGreaterThanOrEqualTo(double other)
Verifies that the actual Double is greater or equal to the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not greater than or equal to the given one.

isLessThanOrEqualTo

public DoubleAssert isLessThanOrEqualTo(double other)
Verifies that the actual Double is less or equal to the given one.

Parameters:
other - the given value.
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not less than or equal to the given one.

isZero

public DoubleAssert isZero()
Verifies that the actual Double is equal to zero.

Specified by:
isZero in interface NumberAssert
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not equal to zero.

isPositive

public DoubleAssert isPositive()
Verifies that the actual Double is positive.

Specified by:
isPositive in interface NumberAssert
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not positive.

isNegative

public DoubleAssert isNegative()
Verifies that the actual Double is negative.

Specified by:
isNegative in interface NumberAssert
Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not negative.

isNaN

public DoubleAssert isNaN()
Verifies that the actual Double is equal to Double.NaN.

Returns:
this assertion object.
Throws:
AssertionError - if the actual Double is not equal to NAN.

delta

@Deprecated
public static DoubleAssert.Delta delta(double d)
Deprecated. use method Delta.delta(double) instead. This method will be removed in version 2.0.

Creates a new holder for a delta value to be used in isEqualTo(double, org.fest.assertions.DoubleAssert.Delta).

Parameters:
d - the delta value.
Returns:
a new delta value holder.


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