### Question:
MathUtil { public static double logit(double p) { if (p > 0 && p < 1) { return Math.log(p / (1 - p)); } throw new IllegalArgumentException("cannot take logit of " + p + ", out of bounds"); }  static double logit(double p); static double ilogit(double x);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testLogitThrowsTooLow() { MathUtil.logit(0); }
@Test(expected = IllegalArgumentException.class) public void testLogitThrowsTooHigh() { MathUtil.logit(1); }
@Test public void testLogit() { assertEquals(0.0, MathUtil.logit(0.5),0.0000001); assertEquals(Math.log(0.5), MathUtil.logit(1.0/3.0),0.0000001); assertEquals(Math.log(1.0/9.0), MathUtil.logit(0.1),0.0000001); assertEquals(Math.log(9.0), MathUtil.logit(0.9),0.0000001); }