I am trying to claim that my double is NaN. Here is the code snippet:
private Double calculateIt(String input){...} assertEquals(Double.NaN, calculateIt("input text"));
Code does not compile, Double.NaN is defined as primitive
public static final double NaN = 0.0d / 0.0;
To make the statement work, I migrate NaN using the Double object.
assertEquals(new Double(Double.NaN), calculateIt("input text"));
Is there a shorter way to do this?
source share