@Test public void testSquareRoot() { final double DELTA = 1e-15; a = 0; double result = calculator.squareRoot(a); Assert.assertEquals(Math.sqrt(a), result, DELTA); a = 1; result = calculator.squareRoot(a); Assert.assertEquals(Math.sqrt(a), result, DELTA); a = 25; result = calculator.squareRoot(a); Assert.assertEquals(Math.sqrt(a), result, DELTA); a = 1544646; result = calculator.squareRoot(a); Assert.assertEquals(Math.sqrt(a), result, DELTA); }
@Test public void testSquareRootWithNegativeNumber() { a = -26665; Double result = calculator.squareRoot(a); Assert.assertNull(result); }