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