### Question:
Fraction { public double getShiftedValue(int shift){ if (denominator == 0) { throw new IllegalArgumentException(); } return this.numerator/(this.denominator + shift); } Fraction(int numerator, int denominator); double getValue(); double getShiftedValue(int shift);  }### Answer:
@Test (expected = java.lang.ArithmeticException.class) public void getShiftedValue_crash() { Fraction f = new Fraction(1,2); f.getShiftedValue(-2); }
@Test public void getShiftedValue(){ Fraction f = new Fraction(1,2); double value = f.getShiftedValue(1); assertEquals (0.0, value, 0.0000001); }
@Test (expected = java.lang.IllegalArgumentException.class) public void getShiftedValue_zero(){ Fraction f = new Fraction(1,0); double value = f.getShiftedValue(1); }