### Question:
NumberVerifier { public static boolean isInfinityAndNotNaN(Number number) { if (Double.class == number.getClass() || Float.class == number.getClass()) { double dValue = number.doubleValue(); if (Double.isNaN(dValue)) { throw new ArithmeticException("Not a valid input: NaN."); } else if (Double.isInfinite(dValue)) { return true; } } return false; } private  NumberVerifier(); static void checkNoInfinityOrNaN(Number number); static boolean isInfinityAndNotNaN(Number number);  }### Answer:
@Test public void shouldReturnsTrueDoubleIsPositiveInfint() { assertTrue(NumberVerifier.isInfinityAndNotNaN(Double.POSITIVE_INFINITY)); }
@Test public void shouldReturnsTrueDoubleIsNegativeInfint() { assertTrue(NumberVerifier.isInfinityAndNotNaN(Double.NEGATIVE_INFINITY)); }
@Test(expectedExceptions = ArithmeticException.class) public void shouldReturnsWhenDoubleIsNAN() { assertTrue(NumberVerifier.isInfinityAndNotNaN(Double.NaN)); }
@Test public void shouldReturnsFalseWhenIsNumberNotInfinity() { assertFalse(NumberVerifier.isInfinityAndNotNaN(Double.MAX_VALUE)); assertFalse(NumberVerifier.isInfinityAndNotNaN(Float.MAX_VALUE)); assertFalse(NumberVerifier.isInfinityAndNotNaN(10)); assertFalse(NumberVerifier.isInfinityAndNotNaN(10L)); }
@Test public void shouldReturnsTrueFloatIsPositiveInfint() { assertTrue(NumberVerifier.isInfinityAndNotNaN(Float.POSITIVE_INFINITY)); }
@Test public void shouldReturnsTrueFloatIsNegativeInfint() { assertTrue(NumberVerifier.isInfinityAndNotNaN(Float.NEGATIVE_INFINITY)); }
@Test(expectedExceptions = ArithmeticException.class) public void shouldReturnsWhenFloatIsNAN() { assertTrue(NumberVerifier.isInfinityAndNotNaN(Float.NaN)); }