### Question:
PrecisionContextRoundedOperator implements MonetaryOperator { public static PrecisionContextRoundedOperator of(MathContext mathContext) { Objects.requireNonNull(mathContext); if(RoundingMode.UNNECESSARY.equals(mathContext.getRoundingMode())) { throw new IllegalArgumentException("To create the MathContextRoundedOperator you cannot use the RoundingMode.UNNECESSARY on MathContext"); } if(mathContext.getPrecision() <= 0) { throw new IllegalArgumentException("To create the MathContextRoundedOperator you cannot use the zero precision on MathContext"); } return new PrecisionContextRoundedOperator(mathContext); } private  PrecisionContextRoundedOperator(MathContext mathContext); static PrecisionContextRoundedOperator of(MathContext mathContext); @Override MonetaryAmount apply(MonetaryAmount amount); MathContext getMathContext(); @Override String toString();  }### Answer:
@Test(expectedExceptions = NullPointerException.class) public void shouldReturnNullPointerExceptionWhenParameterIsNull() { PrecisionContextRoundedOperator.of(null); fail(); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldReturnErrorWhenScaleIsUNNECESSARY() { MathContext mathContext = new MathContext(2, RoundingMode.UNNECESSARY); PrecisionContextRoundedOperator.of(mathContext); fail(); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldReturnErrorWhenPrecisionIsZero() { MathContext mathContext = new MathContext(0, RoundingMode.HALF_EVEN); PrecisionContextRoundedOperator.of(mathContext); fail(); }