net.sf.magnitude.test
Class Assert

java.lang.Object
  extended by net.sf.magnitude.test.Assert

public final class Assert
extends java.lang.Object

A set of assert methods to be used with JUnit testing library.

Author:
Philippe Pinard

Method Summary
static void assertEquals(Magnitude expected, Magnitude actual, Magnitude precision)
          Asserts whether two Magnitudes are almost equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertEquals

public static void assertEquals(Magnitude expected,
                                Magnitude actual,
                                Magnitude precision)
Asserts whether two Magnitudes are almost equal. To be equal they must have the same units and the difference between their value must be less than the precision.

Parameters:
expected - expected value
actual - actual value
precision - level of precision
Throws:
junit.framework.AssertionFailedError - if the two Magnitude are not almost equal
java.lang.IllegalArgumentException - if the precision is less than 0.0
java.lang.IllegalArgumentException - if the precision is not a number (NaN)