org.truth0.subjects
Class PrimitiveDoubleArraySubject

java.lang.Object
  extended by org.truth0.subjects.Subject<org.truth0.subjects.AbstractArraySubject<T>,T>
      extended by org.truth0.subjects.PrimitiveDoubleArraySubject

@GwtCompatible
public class PrimitiveDoubleArraySubject
extends Subject<org.truth0.subjects.AbstractArraySubject<T>,T>

A Subject to handle testing propositions for double[]. Note: this class deprecates some common methods because the operation of equality and comparison on floating point numbers requires additional specification. Alternatives equality tests are provided.

Author:
Christian Gruber (cgruber@israfil.net)

Field Summary
 
Fields inherited from class org.truth0.subjects.Subject
failureStrategy
 
Constructor Summary
PrimitiveDoubleArraySubject(FailureStrategy failureStrategy, double[] o)
           
 
Method Summary
protected  void failWithBadType(Object expected)
           
protected  String getDisplaySubject()
           
 void isEqualTo(Object expected)
          Deprecated. use isEqualTo(Object, double)
 void isEqualTo(Object expected, double tolerance)
          A proposition that the provided double[] is an array of the same length and type, and contains elements such that each element in expected is equal to each element in the subject, and in the same position.
 void isNotEqualTo(Object expected)
          Deprecated. use isNotEqualTo(Object, double)
 void isNotEqualTo(Object expectedArray, double tolerance)
          A proposition that the provided double[] is not an array of the same length or type, or has at least one element that does not pass an equality test within the given tolerance.
protected  List<Double> listRepresentation()
           
protected  String underlyingType()
           
 
Methods inherited from class org.truth0.subjects.Subject
check, equals, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getSubject, hashCode, internalCustomName, is, isA, isNotA, isNotNull, isNull, labeled, named
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveDoubleArraySubject

public PrimitiveDoubleArraySubject(FailureStrategy failureStrategy,
                                   double[] o)
Method Detail

underlyingType

protected String underlyingType()

listRepresentation

protected List<Double> listRepresentation()

isEqualTo

@Deprecated
public void isEqualTo(Object expected)
Deprecated. use isEqualTo(Object, double)

This form is unsafe for double-precision floating point types, and will throw an UnsupportedOperationException.

Overrides:
isEqualTo in class Subject<org.truth0.subjects.AbstractArraySubject<double[]>,double[]>

isEqualTo

public void isEqualTo(Object expected,
                      double tolerance)
A proposition that the provided double[] is an array of the same length and type, and contains elements such that each element in expected is equal to each element in the subject, and in the same position.


isNotEqualTo

@Deprecated
public void isNotEqualTo(Object expected)
Deprecated. use isNotEqualTo(Object, double)

This form is unsafe for double-precision floating point types, and will throw an UnsupportedOperationException.

Overrides:
isNotEqualTo in class Subject<org.truth0.subjects.AbstractArraySubject<double[]>,double[]>

isNotEqualTo

public void isNotEqualTo(Object expectedArray,
                         double tolerance)
A proposition that the provided double[] is not an array of the same length or type, or has at least one element that does not pass an equality test within the given tolerance.


getDisplaySubject

protected String getDisplaySubject()
Overrides:
getDisplaySubject in class Subject<org.truth0.subjects.AbstractArraySubject<T>,T>

failWithBadType

protected void failWithBadType(Object expected)


Copyright © 2014. All rights reserved.