1 2 import static org.junit.Assert.*; 3 4 { 5 /** Our margin for round-off errors -- this approach is only acceptable in a toy example! */ 6 private static double TOLERANCE = = 0.00000000001; 7 8 @Test 9 { 10 /* What we're testing in this method */ 11 final String TESTWHAT = "test 1: sqrt(45) * sqrt(45) should be close to 45"; 12 13 double x = 45; 14 assertFalse(TESTWHAT, Math.abs((Math.sqrt(x) * Math.sqrt(x)) - x) > TOLERANCE); 15 } 16 }