@Test
public void testModInverseArithmeticException() {

  try {
    modInverse(BigInteger.ONE, BigInteger.valueOf(-1));
    fail("ArithmeticException expected");
  } catch (ArithmeticException expected) {
  }
  try {
    modInverse(BigInteger.valueOf(3), BigInteger.valueOf(9));
    fail("ArithmeticException expected");
  } catch (ArithmeticException expected) {
  }
}