Home | History | Annotate | Download | only in number
      1 package org.hamcrest.number;
      2 
      3 import org.hamcrest.Matcher;
      4 import org.junit.Test;
      5 
      6 import static org.hamcrest.AbstractMatcherTest.*;
      7 import static org.hamcrest.number.IsNaN.notANumber;
      8 
      9 public final class IsNanTest {
     10 
     11     @Test public void
     12     copesWithNullsAndUnknownTypes() {
     13         Matcher<Double> matcher = notANumber();
     14 
     15         assertNullSafe(matcher);
     16         assertUnknownTypeSafe(matcher);
     17     }
     18 
     19     @Test public void
     20     matchesNaN() {
     21         assertMatches(notANumber(), Double.NaN);
     22     }
     23 
     24     @Test public void
     25     doesNotMatchDoubleValue() {
     26         assertDoesNotMatch(notANumber(), 1.25);
     27     }
     28 
     29     @Test public void
     30     doesNotMatchInfinity() {
     31         assertDoesNotMatch(notANumber(), Double.POSITIVE_INFINITY);
     32     }
     33 
     34     @Test public void
     35     describesItself() {
     36         assertDescription("a double value of NaN", notANumber());
     37     }
     38 
     39     @Test public void
     40     describesAMismatch() {
     41         assertMismatchDescription("was <1.25>", notANumber(), 1.25);
     42     }
     43 }
     44