### Question:
Library { public static boolean isPrime(int x) { if (x < 0) throw new IllegalArgumentException("Negative number"); if (x == 0 || x == 1) return false; else if (x == 2) return true; else { if (x % 2 == 0) return false; for (int i = 3, end = sqrt(x); i <= end; i += 2) { if (x % i == 0) return false; } return true; } }  static String reverse(String s); static boolean isPalindrome(String s); static boolean isPalindrome(int x); static int sqrt(int x); static long sqrt(long x); static BigInteger sqrt(BigInteger x); static boolean isSquare(int x); static int pow(int x, int y); static int powMod(int x, int y, int m); static int reciprocalMod(int x, int m); static BigInteger factorial(int n); static BigInteger binomial(int n, int k); static int gcd(int x, int y); static boolean isPrime(int x); static boolean[] listPrimality(int n); static int[] listPrimes(int n); static int[] listSmallestPrimeFactors(int n); static int totient(int n); static int[] listTotients(int n); static boolean nextPermutation(int[] arr);  }### Answer:
@Test public void testIsPrime() { assertFalse(Library.isPrime(0)); assertFalse(Library.isPrime(1)); assertTrue(Library.isPrime(2)); assertTrue(Library.isPrime(3)); assertFalse(Library.isPrime(4)); assertTrue(Library.isPrime(5)); assertFalse(Library.isPrime(6)); assertTrue(Library.isPrime(7)); assertFalse(Library.isPrime(8)); assertFalse(Library.isPrime(9)); assertFalse(Library.isPrime(10)); assertTrue(Library.isPrime(11)); assertFalse(Library.isPrime(12)); assertTrue(Library.isPrime(13)); assertFalse(Library.isPrime(14)); assertFalse(Library.isPrime(15)); assertFalse(Library.isPrime(16)); assertTrue(Library.isPrime(17)); assertFalse(Library.isPrime(18)); assertTrue(Library.isPrime(19)); assertFalse(Library.isPrime(20)); }
@Test(expected=IllegalArgumentException.class) public void testIsPrimeInvalid0() { Library.isPrime(-1); }
@Test(expected=IllegalArgumentException.class) public void testIsPrimeInvalid1() { Library.isPrime(-3000); }